Anybody know how to programmatically add an IP address to a Server 2008 Windows Firewall with Advanced Security rule?
i.e. I've setup a Block Action firewall rule which has some IP addresses listed under the "Remote IP address" section of the Scope. I want to be able to programmatically add (or perhaps remove) IP addresses from this list. Are there .NET objects available to do this?
Step 1) On the Start menu, Click 'Windows Firewall with Advanced Security'. Step 2) Click the 'Advanced settings' option in the sidebar. Step 3) On the left side, click the option 'Inbound Rules'. Step 4) On the right, under the section 'Actions', click on the option 'New Rule'.
The Windows Firewall with Advanced Security Start Page can be found at:
http://msdn.microsoft.com/en-us/library/ff956124(v=VS.85).aspx
Specifically, it seems you need the INetFwRule Interface which is described at:
http://msdn.microsoft.com/en-us/library/aa365344(v=VS.85).aspx
Check the get_RemoteAddresses and put_RemoteAddresses
You can also try the netsh environment.
I used it once for changing the MTU of my interface
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With