Create a Shortcut Icon or Hotkey to Turn Windows 7 / Vista Firewall On or Off

When you are troubleshooting network problems, one of the first things to do is disable the built-in Windows Firewall… but there are just way too many steps required to the firewall on and off. Can’t we make a simple shortcut icon instead?

Naturally we can, using the built-in netsh utility that is usually used on the command line to perform advanced networking functions. We’ll simply create a shortcut to it with the appropriate parameters.

Note: Always remember to turn the Firewall back on after you are done troubleshooting, especially if you use public wireless networks.

Create Shortcut Icons for Enable/Disable

Right-click on the desktop or elsewhere, and choose New \ Shortcut from the menu.

image

Then in the shortcut location box, you’ll add one of two commands listed below.

image

Disable Firewall

netsh firewall set opmode disable

Enable Firewall

netsh firewall set opmode enable

Once you’ve added the correct command, go to the next screen and give the shortcut a helpful name like “Disable Firewall”

image

At this point you should have a shortcut icon, but it won’t work yet without choosing to run as administrator.

image

Right-click the shortcut and choose Properties, and then choose the shortcut tab.

image

In this screen you can assign a shortcut key for this shortcut by adding it into the Shortcut key box. The most important step is to click the Advanced button, so we can choose “Run as administrator” to always run the shortcut in administrator mode.

image

You can also change the icon by using the Change Icon button. If you want the shortcuts to really match, you can change the “Look for icons in this file” to the following:

%SystemRoot%\system32\imageres.dll

In that file you can find the red shield icon as well as the green one…

image

So now I have two shortcuts that not only look good, but are functional.

image

If you want to verify that the shortcuts are working, use one of them and then open Windows Firewall through the start menu, and click on the link for “Turn Windows Firewall on or off”

image

Then you should be able to see that the firewall is either on or off.

image

The same shortcuts should also work on Windows XP or Windows 7, even though the screenshots are all for Windows Vista. You don’t need to run as administrator in XP, of course.

Note: Using these shortcuts will very briefly flash the command prompt window on the screen. For extra credit, you could use the hstart utility in your shortcut to hide the command prompt window.

Update: This has been successfully tested on Windows 7 as well.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: