When testing network connectivity or when performing other troubleshooting tasks, you may need to turn off the Windows Firewall temporarily. To quickly disable or enable the Windows Firewall, you may use the Netsh.exe command-line in Windows XP and Windows Vista.

Enabling Windows Firewall

Click Start, Run and type:

Netsh firewall set opmode enable

Disabling Windows Firewall

Click Start, Run and type:

Netsh firewall set opmode disable

Windows Firewall status can be verified using Windows Security Center or the Windows Firewall applet.

Note: In Windows Vista you need to run the above commands from an elevated Command Prompt. To open an elevated Command Prompt, click Start, click All Programs, click Accessories, right-click Command Prompt, and then click Run as administrator.

You may create desktop two shortcuts to enable and disable the Windows Firewall. To run the commands as administrator, right-click on the shortcut and choose Run as administrator. Or right-click the shortcut properties, click Advanced and tick the Run as administrator checkbox and click OK. Double-clicking the shortcut run the Netsh… command elevated, after you click the Continue button in the UAC confirmation dialog.

Customize the shortcut icons by picking an appropriate icon from Shell32.dll, Imageres.dll or from xpsp2res.dll (for Windows XP) for easy identification.

Editor’s Note: Although the netsh firewall command works fine in Windows XP, Windows Vista and Windows Server 2008 Operating Systems, Microsoft recommends that you use the netsh advfirewall firewall command in Windows Vista and Windows Server  2008.

The netsh firewall command-line context might be deprecated in a future version of the Windows operating system. We recommend that you use the netsh advfirewall firewall context to control firewall behavior.

For more information. see article KB947709 titled "How to use the “netsh advfirewall firewall” context instead of the “netsh firewall” context to control Windows Firewall behavior in Windows Server 2008 and in Windows Vista."


Email SubscriptionPrefer an E-mail subscription?

Enter your email address:

Delivered by FeedBurner

One Comment

  1. beginner
    said this on Wednesday, September 7th 2011 2:59 pm

    Wow! Thanks!! I am truly grateful for this article !!!

Leave a Reply