Using PowerShell to disable a network adapter

by Mitch Tulloch [Published on 4 Sept. 2013 / Last Updated on 4 Sept. 2013]

A tip on how you can use Windows PowerShell to disable a network adapter on Windows Server 2012.

You can disable a specific network adapter or even all network adapters using Windows PowerShell. For example, the following command disables the adapter named “Ethernet 2” with no confirmation prompt displayed:

PS C:\> Disable-NetAdapter -Name "Ethernet 2" -Confirm:$false

To disable all network adapters on the server, you can use this command:

PS C:\> Disable-NetAdapter -Name *

Note that all remote connectivity with the server will be lost if you do this.

To enable any network adapters that are disabled, you can use the Enable-NetAdapter cmdlet.

Mitch Tulloch is a nine-time recipient of the Microsoft Most Valuable Professional (MVP) award and a widely recognized expert on Windows administration, deployment and virtualization.  For more information see http://www.mtit.com. This tip was excerpted from his latest book Training Guide: Installing and Configuring Windows Server 2012 from Microsoft Press.

Featured Links