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.
2 thoughts on “Using PowerShell to disable a network adapter”
can you please mention the Windows version/Powershell version required to run this command?
… it’s really annoying to find hints/information/help from experts about something you’re looking for, only to find out the things don’t work because someone forgot to mention some crucial information.
This tip is dated June 2013 and if you google “powershell versions” you’ll see that PowerShell 4.0 was introduced in October 2013, so this tip applies to PowerShell 3.0 which was included with Windows 8 and Windows Server 2012.