简体   繁体   中英

Remove firewall rule with no exe attached

I was doing some experiments with firewall and in result I have added some firewall rules which doesn't have exe attached to them. Now I am unable to remove these from firewall. Remove button is disabled for those rules when I go to "Allow app to firewall" and in program I am also unable to do that as it processes exe path instead of rule name. What should I do now? How to remove these entries?

Here is my remove code.

Type objectType = Type.GetTypeFromCLSID(new Guid(CLSID_FIREWALL_MANAGER));
var firewallManger = Activator.CreateInstance(objectType) as NetFwTypeLib.INetFwMgr;
firewallManger.LocalPolicy.CurrentProfile.AuthorizedApplications.Remove(imagePath); //imagePath is exe path.

转到Windows-Firewall->“高级设置”而不是传入规则中的“允许应用程序进入防火墙”,您应该可以将其删除

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM