How to add Application to Windows Server Firewall Exception list?
This code:

                INetFwRule firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
                firewallRule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
                firewallRule.Description = "Allow KSS";
                firewallRule.ApplicationName = exePath;
                firewallRule.Enabled = true;
                firewallRule.InterfaceTypes = "All";
                firewallRule.Name = "KSS";

                INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
                firewallPolicy.Rules.Add(firewallRule);

                //M ark the EXE as added
                MarkExeExceptionHasAdded(exePath);

Do not work with Windows Server 2008 and 2008 R2 - it only work in Windows client (Vista, 7), what's wrong?
How to add Application to Windows Server Firewall Exception list?
===

This code:

                INetFwRule firewallRule = (INetFwRule)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FWRule"));
                firewallRule.Action = NET_FW_ACTION_.NET_FW_ACTION_ALLOW;
                firewallRule.Description = "Allow KSS";
                firewallRule.ApplicationName = exePath;
                firewallRule.Enabled = true;
                firewallRule.InterfaceTypes = "All";
                firewallRule.Name = "KSS";

                INetFwPolicy2 firewallPolicy = (INetFwPolicy2)Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));
                firewallPolicy.Rules.Add(firewallRule);

                //M ark the EXE as added
                MarkExeExceptionHasAdded(exePath);

Do not work with Windows Server 2008 and 2008 R2 - it only work in Windows client (Vista, 7), what's wrong?