Netsh can configure Windows 7 Firewall rules!

By | May 30, 2013
Share

The Netsh utility is constantly surprising me what it can accomplish. Using this site (http://windowsitpro.com/windows-server/top-10-windows-firewall-netsh-commands), I was able to script opening 3 ports in a couple of minutes. Thanks WindowsItPro..

REM Turn On Firewall for All Profiles
netsh advfirewall set allprofiles state on

REM Allow pings
netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4

REM Configure Ports
netsh advfirewall firewall add rule name="rule name" dir=in action=allow protocol=UDP localport=162
netsh advfirewall firewall add rule name="rule name" dir=in action=allow protocol=TCP localport=21

/BrianG

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.