title: Programmatically add rules to "Windows Firewall with Advanced Security snap-in"?
body: <p>Is there any library in .NET that would allow me to manipulate the Windows Firewall with Advanced Security in Windows 7?</p>
  
  <p>The reason I ask this is because, I want to be able to add program/port exceptions programmatically.</p>
  
  <p>For example, I want to add program.exe to the Inbound Rules section and for this program, I want to allow TCP port 5660 and UDP port 5660. All other ports should be blocked for this program alone; </p>
  
  <p>I reasoned that this could be comfortably set in the Inbound Rules Section in Windows Firewall with Advanced Security; I hope this is the best way of doing it?</p>
  
  <p>However, how would I accomplish that programmatically?</p>
  
  <p>I have already seen an example <a href="https://stackoverflow.com/questions/113755/programmatically-add-an-application-to-windows-firewall">here</a>, but I think this one talks about "Allow a program through Windows Firewall snap-in", which does not have the port information.</p>