I have a Win2K8 Firewall custom rule that blocks access to particular IP addresses. I have a long list to import and I would like to know if there is a way to do that programatically. I want to (1) make sure that the IPs are added to my existing rule and (2) add them as ranges of IPs. I have about ten different IP ranges that I would like to add. Is there a PnP script that can do this?
I have a Win2K8 Firewall custom rule that blocks access to particular IP addresses.
Share
Modifying of Win2K8 firewall rules can be achieved through the command-line tool
netsh.To add a new rule:
netsh advfirewall firewall add rule ...To update an existing rule:
netsh advfirewall firewall set rule ...Since you’ve not given details of your file format, or any information on your existing rule, it’s difficult to suggest the exact syntax required beyond the above.
If the file format is relatively simple, and the IPs are in a form that
netshwill accept, it may be possible to use simple batch scripting rather than having to write a C# application to update the firewall rules. If not, then you can write C# application to process the file, and call out tonetshin order to perform the actual firewall rule changes.