This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Disable-NetworkAdapter

Synopsis

Disables network adapters on a local or remote computer.

Syntax

  • Disable-NetworkAdapter [-Name] [-ComputerName] [-Credential]
  • Disable-NetworkAdapter [-MACAddress] [-ComputerName] [-Credential]

Description

The Disable-NetworkAdapter cmdlet is used to disable network adapters on a local or remote computer. Adapters can be identified by name or MAC address. You must specify exact adapter names when using this cmdlet - wild cards are not permitted.

Parameters

  • Name The name of the network adapter to configure. This parameter cannot be used when the MACAddress parameter has been specified.
  • MACAddress The MAC address of the network adapter to configure.This parameter cannot be used when the Name parameter has been specified.
  • ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
  • Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.

Inputs

Disable-NetworkAdapter accepts the output of Get-NetworkAdapter as an input object. The Name, MACAddress and ComputerName parameters each accept pipeline input by property name.

Outputs

Disable-NetworkAdapter makes changes directly to Windows and does not output any Powershell objects.

Notes

The cmdlet requires that the RPC service are started on the computer it is trying to access and that DNS services are available to resolve target host names.

Example 1

This command will disable the network adapter "Local Area Connection" on the local computer:

C:\PS> Disable-NetworkAdapter "local area connection"

Example 2

This command will disable the network adapter with MAC address 00:0E:FF:49:08:DE on the remote computer PC01:

C:\PS> Disable-NetworkAdapter -MACAddress 00:0E:FF:49:08:DE -Computer PC01

Example 3

The Disable-NetworkAdapter cmdlet can work in conjunction with the Get-NetworkAdapter cmdlet. This example will disable any network adapters found on the local computer that include the word 'wireless' in the name:

C:\PS> Get-NetworkAdapter -Name *wireless* | Disable-NetworkAdapter