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

Nik Mayekar 1 Reputation point
2020-08-01T14:22:38.437+00:00

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 Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,109 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,359 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 44,776 Reputation points
    2020-08-01T15:14:37.35+00:00

    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.

    1 person found this answer helpful.
    0 comments No comments

  2. 2020-08-20T01:38:24.177+00:00

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

    0 comments No comments