I would like to get a specific firewall rule by name and see the options it uses (The IP Scope specifically) and compare it to something. Is this possible, I searched online but couldn't find anything.
This is how I am adding rules:
INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
INetFwRule firewallRule = firewallPolicy.Rules.OfType<INetFwRule>().Where(x => x.Name == RULE_NAME).FirstOrDefault();
if (firewallRule == null)
{
firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
firewallRule.Name = RULE_NAME;
/* More stuff */
firewallPolicy.Rules.Add(firewallRule);
}