开发者

Programmatically modify Firewall rules in Windows Server 2008 R2

开发者 https://www.devze.com 2022-12-19 12:19 出处:网络
I want be able to programmatically enable, disable, create firewall rules in Windows Server 2008 R2. What is the object model to modif开发者_如何学运维y the firewall rules from .Net/PowerShell?There i

I want be able to programmatically enable, disable, create firewall rules in Windows Server 2008 R2. What is the object model to modif开发者_如何学运维y the firewall rules from .Net/PowerShell?


There is probably a WMI set of classes for this but I wanted to point out that you can use the existing command line utility netsh.exe from PowerShell. Execute:

netsh firewall /?

To see its options.


There's also using COM:

$fw=new-object -com hnetcfg.fwmgr
0

精彩评论

暂无评论...
验证码 换一张
取 消