spacer.png, 0 kB
spacer.png, 0 kB
Home arrow General Articles arrow Disabling and editing Windows Firewall via cmd with netsh
Disabling and editing Windows Firewall via cmd with netsh Print E-mail

First, Netsh is a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running. Netsh also provides a scripting feature that allows you to run a group of commands in batch mode against a specified computer.

When editing Windows Firwall via cmd you use this command:

“netsh firewall”

Than you get the different commands that are available:

Netsh Firewall commands

The new netsh firewall command can be used to configure Windows Firewall.

This can be done either by opening a command prompt and executing the appropriate netsh commands, or by creating a batch file of netsh commands and running it from a run-once script.

Scenario 1

To disable Windows Firewall on XP SP2 machines in a domain environment, use the following command:

netsh firewall set opmode mode=DISABLE profile=DOMAIN

Scenario 2

Say you want to enable RDP because you want remote desktop to be enable, use the following command:

netsh firewall add portopening TCP 3389 blah enable any

But you also have to add the program with this command:

Netsh firewall add allowedprogram C:\WINDOWS\system32\mstsc.exe mstsc.exe ENABLE

Than you have opened the specified program and port :)


Related Items:

 
< Prev   Next >
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB