Windows: Enable/Disable your LAN or Firewall on Shell

In the distant past, when I still used ZoneAlarm’s desktop firewall, I got used to have a big, red emergency-button to cut off internet-access with one single click. This came in handy from time to time when I suspected strange things happening in the background or when I wanted to use or test a program I suspected to secretly send data home. In the old days of Windows XP the disabling of the network adapter could have also be done with two simple clicks via the tray-symbol. But from Windows 7 on we no longer have a straigth and short path to nearly instantly cut off internet-access. I grumbled upon this matter time and again but never was in the mood to seek for a resolution. Until now. Here are four short commands for the purpose to disable/enable your network-adapter or Windows-Firewall (run them as Admin!). The latter can be useful in cases we just want to cut internet-access but still have access to our local network. The first one completely deactivates our LAN-Adapter.

Disable LAN-Adapter:

netsh interface set interface "Local Area Connection" disabled

Enable LAN-Adapter:

netsh interface set interface "Local Area Connection" enable

Disable Windows-Firewall:

netsh advfirewall set currentprofile firewallpolicy blockinbound,blockoutbound

Enable Windows-Firewall:

netsh advfirewall set currentprofile firewallpolicy blockinbound,allowoutbound

For (de)activating the LAN-Adapter we have to find the exact internal name of our interface (above it’s the string “Local Area Connection”). We do this on the command-line (shell). To get on the shell we hit the keys “WINDOWS + R”, type “cmd” in the dialog-box and hit enter. On the shell we type this line:

netsh interface show interface

After hitting enter we get the name of our interface to paste in the first two commands above as a replacement for the string “Local Area Connection”. Mind to enclose the interface-name with quotes if it contains blanks. We can create a batch-script-file for every of the four commands, store them on desktop and this way have made our own “internet-off-emergeny-buttons”. Just mind to right-click the batch-files and execute them “as Admin” cause otherwise you will get a confusing error-message.

Advertisements

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: