We help IT Professionals succeed at work.
Get Started

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

Last Modified: 2013-11-10
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#
Watch Question
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE