netsh advfirewall firewall
- by lehn0058
I am trying to write a script to configure a windows firewall (server 2008 & 2012 only) to adjust certain firewall settings after a machine has been added to a domain. I need to do this because one of the pre-installed programs on these machines we get only has the firewall rules setup for the public and private firewall profile. This script will be pushed out for other admins to use, and some of the machine will be in other languages.
The command to change an existing firewall rule is as follows:
netsh advfirewall firewall set rule name = "rule name goes here" new profile=domain
This command works great. However, I need to do this for about 10 firewall ports AND since the program could be installed on computers with different languages, I can not just pass the name of all of the firewall rules.
Is their some way to do this by supplying the port number? Or some way to specify a regular expression so I could use any rule that has a name LIKE 'test'?