10.2. Disabling a Connection


You want to disable a network connection for either a virtual interface or a network adapter.


Using a graphical user interface

  1. From the Control Panel open the Network Connections applet.

  2. Right-click the network connection you want to disable and select Disable.

Using a command-line interface

You would think that it would be straightforward to disable a connection from the command line, but unfortunately that is not the case. In fact, the netsh command supports disabling connections, but only non-LAN interfaces, which is very disappointing.

But all is not lost! There is an alternative if you really must have a way to disable connections from the command line. The devcon.exe tool is the command-line alternative to the Device Manager interface and comes with the Driver Development Kit (DDK). You can download it separately by viewing MS KB 311272 (http://support.microsoft.com/default.aspx?scid=311272).

Once you have it downloaded, run this command to get a list of all network devices:

> devcon listclass net

This displays the list of devices in two columns. The left column contains the hardware ID for each device and the right column contains the description for the device.

After you've found the device you want to disable, run the following command:

> devcon disable =net <HardwareID>

For example:

> devcon disable =net PCI\VEN_14B9^&DEV_A504^&SUBSYS_500014B9^&REV_00

There are a couple of important things I need to point out. First, if the hardware ID ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.