Manage Windows Network Settings with Netsh Modifying the Windows Firewall Settings with Netsh Eric Geier
Modifying the Windows Firewall Settings
Changing the firewall settings via the command-line is also beneficial. Maybe you installed a local server and need to add the port to Windows Firewall on all the PCs. Whatever the reason, we'll discuss adding program- and port-based exceptions.
Here's an example of adding a program to the exception list:
netsh firewall set allowedprogram C:\MyApp\MyApp.exe "My Application" ENABLE
(Replace the path and filename, plus the application's name for easier identification in firewall settings. To block the application, use DISABLE instead.)
Here's how you might add a port to the firewall:
set portopening TCP 80 "My Web Port" ENABLE
(Replace TCP with UDP as necessary and insert name for exception within the quotes. To block the port, use DISABLE instead.)
We Passed the Command Line
There's one last tip to take away: from the Command Prompt you can type netsh to enter the tool itself, so you don't have to keep typing netsh before the command. Plus you can move to contexts, such as by entering netshfirewall. Then you can, for example, simply enter show config, set allowedprogram, or other netsh firewall commands directly, without preceding them with netshfirewall.
You should now be able to quickly review the networking and firewall settings at the command-line with Netsh. Plus you should be able to make simple configuration changes. Remember, there are many more commands to discover; we've only reviewed the basic ones in this tutorial.
Eric Geier is the Founder and President of Sky-Nets, Ltd., a Wi-Fi Hotspot Network. He is also the author of many networking and computing books, including Home Networking All-in-One Desk Reference For Dummies (Wiley 2008) and 100 Things You Need to Know about Microsoft(R) Windows Vista (Que 2007).