3 Ways to Disable a Network Connection in Windows 10

Posted on April 21, 2016 by Daniel Petri in Windows 10 with 0 Comments

Windows 10 Hero Good

When we use a computer over a Wi-Fi network, there are some cases in which we want to disable that connection. Usually, this can be done by going to the Network Connections applet in Control Panel, but since Microsoft made it a little more complicated to get to it, it might be easier to have a shortcut on your desktop that lets you do just that.

For this purpose, I made a list of three easy methods of using the command prompt, which includes some  PowerShell commands that can help you do this with ease. Note that these commands should work on Windows 7, 8, and 8.0, and you’ll need to open the command prompt or PowerShell with administrative permissions to properly run these commands.

 

Method 1: Using WMIC

To use the WMIC command in the command prompt, we need to identify the correct index number of the required network interface, which we’ll then use to enable or disable the network.

To get the network interface list and index number type:

Grabbing the index number of the network interface. (Image Credit: Daniel Petri)

Grabbing the index number of the network interface. (Image Credit: Daniel Petri)

Type the following to disable the network interface with the required index number, which let’s say is 4 for this example:

Disabling the network interface. (Image Credit: Daniel Petri)

Disabling the network interface. (Image Credit: Daniel Petri)

Now in the control panel, you should see that the desired network connection is now disabled.

Disabled wi-fi connection in the control panel. (Image Credit: Daniel Petri)

Disabled wi-fi connection in the control panel. (Image Credit: Daniel Petri)

To enable the network interface with the required index number, type the following.

Enabling the network interface in the command line. (Image Credit: Daniel Petri)

Enabling the network interface in the command line. (Image Credit: Daniel Petri)

The Wi-Fi network is now enabled. (Image Credit: Daniel Petri)

The Wi-Fi network is now enabled. (Image Credit: Daniel Petri)

If you only want to enable and/or disable the Wi-Fi adapters, you can use these 2 lines:

Note: For some previous operating systems, replace “Wi-Fi” with “Wireless”, that should do the trick. Anyway, if you want to know how your computer treats any specific NIC adapter, add “NetConnectionID” to the first WMIC command:

If you want to be a bit more sophisticated, you can use a “like” option to identify the “NetConnectionID”:

Sponsored

Method 2: Using NETSH

To perform the same task but with the NETSH command in command prompt, we need to identify the name of the required network interface, which we’ll then use it to enable or disable it, as needed.

To get the network interface name type:

Using netsh in the command line. (Image Credit: Daniel Petri)

Using netsh in the command line. (Image Credit: Daniel Petri)

To disable the network interface with the required name: (for example: Wi-Fi)

To enable the network interface with the required name: (for example: Wi-Fi)

control-wifi-cmd-7

Sponsored

Method 3: Using PowerShell

Obviously, PowerShell can also be used to perform these tasks, and although it’s possible to run many types of scripts that will do this and much more, there are a few simple commands that we can use for the purpose of disabling and enabling the Wi-Fi network interface.

To get the network interface list, use the Get-NetAdapter cmdlet.

Get-NetAdapter in Windows PowerShell. (Image Credit: Daniel Petri)

Get-NetAdapter in Windows PowerShell. (Image Credit: Daniel Petri)

To enable the network interface with the required name: (for example: Wi-Fi)

To disable the network interface with the required name: (for example: Wi-Fi)

Note that we’re adding the “-Confirm:$false” switch to avoid having to acknowledge the prompt.

Adding a switch statement. (Image Credit: Daniel Petri)

Adding a switch statement. (Image Credit: Daniel Petri)

Sponsored