question

NikMayekar-6456 avatar image
0 Votes"
NikMayekar-6456 asked YoungYang-MSFT answered

I want to update an ip in a rule in windows firewall using a command, how to do it?

I have n number of servers on which I have setup a rule "Office Ip" for allowing access to server from my local machine.

Now I want to add my local static ip in "Office Ip" rule setup on every server of mine using a command. For this I will have to do following:

  1. command to login to every server

  2. update my local static ip in the rule "Office Ip" rule using command

Like wise I want to allow it on n number of my servers.

How can I do it?

Please refer the diagramatic attachment for clear understanding

14934-ip-update.jpg


windows-serverwindows-server-powershell
ip-update.jpg (82.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
1 Vote"
RichMatheisen-8856 answered

This answer in the link should accomplish the task.

powershell-script-to-add-multiple-remote-address-to-firewall-rules



Put whatever code you create into a script block and use the script block in an Invoke-Command. Provide the Invoke-Command with a list of machine names and the necessary credentials to log on and to modify the firewall rule.

However, using a GPO would probably be the preferred way to accomplish the task, especially if these machines are domain members.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

YoungYang-MSFT avatar image
0 Votes"
YoungYang-MSFT answered

May I ask whether your question has been resolved, and if it is resolved, please don’t forget to mark it as an answer.
:)

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.