We help IT Professionals succeed at work.

Using .net C# to access and change the Windows Firewall 'Scope' list of a firewall rule to block IPs

Hello All!,
I would like to be able to interface with the "Windows Firewall with Advanced Security" so that I can maintain a list of blocked IPs on a system. I would like to be able to interface using c# code so that I have direct control of this firewall rule.

I have created an example rule in "Windows Firewall with Advanced Security" and added an address to the scope list, see the image below. Im just wondering how I can get a handle on this IP address list so that I can change it from my c# code, is there a specific library I can include?

Im looking to run the application on Windows 7 and Windows 2008 Server which both appear to have the same  "Windows Firewall with Advanced Security" application built into the OS.

Hope you can help and many thanks in advance :) The example rule I have created that I would like to be able to edit from c#
Comment
Watch Question

I carried on fishing round and found this over at The Code Project. Hope this helps anyone who is looking for a similar solution, it works for me!

http://www.codeproject.com/KB/vista-security/VistaFirewallNet.aspx