When you are troubleshooting various 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. Is there a way to make a simple shortcut instead? Yes 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.
To Create Shortcut Icons For Firewall Enable/Disable:
Right-click on the desktop or elsewhere, and choose New, then Shortcut from the menu.
Then in the shortcut location box, you’ll add one of two commands listed below.
To Disable Firewall:
netsh firewall set opmode disable
To Enable Firewall:
netsh firewall set opmode enable
Once you’ve added the correct command, click next, on the next screen give the shortcut a helpful name like 'Disable Firewall'.
At this point you should have a shortcut icon, but it won’t work yet without choosing to run as administrator.
Right-click the shortcut and choose Properties, then choose the shortcut tab.
In the screen above 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.
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:
In that file you can find both the red shield icon as well as the green shield one.
After repeating the above for the other shortcut you will now have 2 nice looking as well as functional shortcuts.
You will notice when you click on the shortcuts that a Command Window flashes on the screen, which is ok if you don't mind.
If you want to have the firewall shortcuts run clean you can do the following:
First open note pad and enter the following one line VBS Script.
CreateObject("Wscript.Shell").Run "" & WScript.Arguments(0) & "", 0, False
Then save the file as 'Somename.vbs', in our case we named it invisableCMD.vbs.
We placed the file in the 'Windows\System32' directory, seemed like a good place to call it from.
Now right-click one of the Icons you made and select Properties and select the Shortcut tab.
Then change the target box to:
%SystemRoot%\System32\wscript.exe "invisibleCMD.vbs" "%SystemRoot%\System32\netsh.exe firewall set opmode disable"
Then do the same for the other Icon entering:
%SystemRoot%\System32\wscript.exe "invisibleCMD.vbs" "%SystemRoot%\System32\netsh.exe firewall set opmode enable"
The wscript.exe command runs the vbs script which runs our command line hidden.
Now that you know how the Firewall Shortcuts work, and you are feeling a bit lazy you can download our installer for the above here.
It will install the shortcuts in your Start Programs folder and Desktop with an uninstaller if you choose to later delete them.
Thanks for visting mswintips.com.
Return to Index Page
Copyright ©2018 CSN All Rights Reserved