Windows Firewall is by default a GUI-driven application; yet in many a situation, especially in cases when unattended changes should be made, or any other kind of automation is expected, command-line solutions could do well.
First, start a network configuration tool prompt, running the following command whil in Windows command box (usually cmd.exe):
netsh
Netsh, or net shell command tool, is a command-line interface for further network configuration tasks. To use it for firewall configuration, make use of the following command while in netsh shell.
advfirewall
Note that netsh should be run in an elevated context, i.e., run under an administrative user.
After you start the advfirewall, you are in its command shell. An example of command could be
show allprofiles
it reports the firewall state. To run Windows firewall on all profiles, use
set allprofiles state on
to switch the firewall on for all profiles. To terminate all the inbound connections, use
advfirewalll set allprofiles firewallpolicy blockinbound,allowoutbound
As usual, type 'help' to get the list of all the commands for the current context. Please keep in mind that all the commands may be run in this way:
netsh advfirewall set allprofiles state on
This article was brought to you by the developers of IPHost Network Monitor, network and server monitoring software.