C# - How to chceck if external firewall is enabled

2019-01-27 07:35发布

We want to use Cisco NAC and need to check if client Desktop has a firewall installed. This may be not the default Windows Firewall.

Is there some Windows registry key that can be checked?

2条回答
冷血范
2楼-- · 2019-01-27 08:21

For non-Windows firewalls, you can use WMI API to detect the presence of a firewall if it's registered with Windows.

Namespace = "Root\SecurityCenter2"  (might be "Root\SecurityCenter" on pre-vista)
Query = "SELECT * From FirewallProduct"

And you can use this little gem to detect if it's actually on or off.

For Windows Firewall detection, it's INetFwMgr and friends.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-27 08:25

Maybe just check if you can establish connection, if you can't - display a message that user should check firewall if it's installed?

查看更多
登录 后发表回答