title: Adding an application firewall rule to both private and public networks via win7 FirewallAPI
body: <p>A little background: Basicaly I'd like to add a program firewall access rule to both private and public networks.</p>
  
  <p>I used to use this-
  "netsh firewall add allowedprogram program= "Path.." name=AppName ENABLE scope=ALL profile=CURRENT"</p>
  
  <p>But now I'd like to automate the proccess a little using a COM object.
  Found this shiny piece of code - <a href="http://web.archive.org/web/20070707110141/http://www.dot.net.nz/Default.aspx?tabid=42&amp;mid=404&amp;ctl=Details&amp;ItemID=8" rel="noreferrer">http://web.archive.org/web/20070707110141/http://www.dot.net.nz/Default.aspx?tabid=42&amp;mid=404&amp;ctl=Details&amp;ItemID=8</a></p>
  
  <p>And after implementing the class I've been trying to use-
  FirewallHelper.Instance.GrantAuthorization(@"Path... ","AppName ",NET_FW_SCOPE_.NET_FW_SCOPE_ALL,NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY);</p>
  
  <p>The problem I'm facing is that the GrantAuthorization method will only add a rule for the public OR private network whereas my old netsh command would 2 rules for- 1 for each network.</p>
  
  <p>The commands actually seems very similar so it is kinda buffling to me.</p>
  
  <p>So... how to add both network rules? </p>
  
  <p>Shaun</p>