Control Windows Firewall Via Command Line
The Windows Firewall feature of Microsoft® Windows® XP Service Pack 2 (SP2), a replacement for the Internet Connection Firewall (ICF) in previous versions of Windows XP, is a stateful host firewall that provides protection for computers against incoming traffic from the Internet or from neighboring network devices on a private network.
Setting up Windows firewall from the GUI is easy, but there is another way you can control your firewall configuration, and this is via the command line.
In order to control Windows firewall from the command line Microsoft provides you with the Netsh.
The following Netsh commands can be used in scripts or at the command line to configure Windows Firewall for IPv4 and IPv6 traffic when executed from the netsh firewall context:
- add allowedprogram – Add the excepted programs
- set allowedprogram – Set the excepted programs
- delete allowedprogram – Delete the excepted programs
- set icmpsetting – Set the ICMP settings
- set multicastbroadcastresponse – Set multicast/broadcast response settings
- set notifications – Set the settings for notifications
- set logging – Set the logging settings.
- set opmode – Set the operational mode
- add portopening – Add excepted ports
- set portopening – Set the excepted ports.
- delete portopening – Delete excepted ports.
- set service – Set the services
- show commands – Show current configurations (see below)
- Reset - Resets firewall configuration to default.
So for instance, if you want to disable the firewall just type: netsh firewall set opmode DISABLE
Show commands
The following show commands are used to display the current configuration:
- show allowedprogram - Displays the excepted programs.
- show config - Displays the local configuration information.
- show currentprofile - Displays the current profile.
- show icmpsetting - Displays the ICMP settings.
- show logging - Displays the logging settings.
- show multicastbroadcastresponse - Displays multicast/broadcast response settings.
- show notifications - Displays the current settings for notifications.
- show opmode - Displays the operational mode.
- show portopening Displays the excepted ports.
- show service - Displays the services.
- show state - Displays the current state information.
So if for instance you want to see the logging setting, simply type netsh firewall show logging
To find out more, simply type netsh firewall ?
Tweet
|

RSS Feeds 
