How to check for Windows 7 Firewall Rules existance RRS feed

  • Question

  • Hi to everyone! Please help me find a solution. How to check for rules existance in windows firewall.

    I am trying to enumerate the rules, but cannot access needed rule by name:

     INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(
                INetFwRules fwRules = firewallPolicy.Rules;            
                foreach (INetFwRule fwRule in fwRules)
                   if (fwRule.Name == "Test")
                       //i want to do something here, but 
                       condition doesn't work


    • Moved by Mike Dos Zhang Monday, November 5, 2012 3:31 AM Security api (From:General Windows Desktop Development Issues)
    Sunday, November 4, 2012 2:39 AM