I want to add a program to windows firewall. I have done that successfuly using this code:
INetFwAuthorizedApplication fwApp = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwAuthorizedApplication")) as INetFwAuthorizedApplication;
fwApp.Name = "Description";
fwApp.Enabled = true;
fwApp.ProcessImageFileName = applicationPath;
fwApp.Scope = NET_FW_SCOPE_.NET_FW_SCOPE_ALL;
fwApp.IpVersion = NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY;
INetFwMgr fwMgr = Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwMgr")) as INetFwMgr;
fwMgr.LocalPolicy.CurrentProfile.AuthorizedApplications.Add(fwApp);
But, the program is added only to the private Network profile. How do I add it to all profiles (private,public,domain) ?