Friday, January 2, 2009

How to Enable or Disable Firewall from the Command Line in Windows Server 2008 and Windows Vista

How to Enable or Disable Firewall from the Command Line in Windows Server 2008 and Windows Vista

Instead of using the GUI, you can enable and disable the Windows Firewall from the command line. A must for any command line junkie.

You will need to use an elevated command prompt to do this.

1. Click the Start button.

2. Click All Programs and select Accessories.

3. Right-click Command Prompt and select Run as administrator.

To Enable the Windows Firewall, use the following:
netsh advfirewall set currentprofile state on

To Disable the Windows Firewall, use the following:
netsh advfirewall set currentprofile state off

After the command has been executed, the prompt will return an Ok when the Firewall has been enabled/disabled.

No comments: