Disconnect-VMNetworkAdapter

Disconnects a virtual network adapter from a virtual switch or Ethernet resource pool.

Syntax

Disconnect-VMNetworkAdapter
          [-VMName] <String[]>
          [[-Name] <String[]>]
          [-ComputerName <String[]>]
          [-Passthru]
Disconnect-VMNetworkAdapter
          [-VMNetworkAdapter] <VMNetworkAdapter[]>
          [-Passthru]

Description

The Disconnect-VMNetworkAdapter cmdlet disconnects a virtual network adapter from a virtual switch or Ethernet resource pool.

Examples

Example 1

PS C:\>Disconnect-VMNetworkAdapter -VMNetworkAdapter Test1

Disconnects virtual network adapter Test1.

Example 2

PS C:\>Get-VMNetworkAdapter -VMName * | Where-Object {$_.SwitchName -eq 'InternetAccess'} | Disconnect-VMNetworkAdapter

Disconnects all virtual network adapters whose SwitchName is InternetAccess in all virtual machines on the local Hyper-V server.

Required Parameters

-VMName

Specifies the name of the virtual machine in which the virtual network adapter is to be disconnected.

Type:String[]
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VMNetworkAdapter

Specifies the virtual network adapter to be disconnected.

Type:VMNetworkAdapter[]
Position:1
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-ComputerName

Specifies one or more Hyper-V hosts on which a virtual network adapter is to be disconnected. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer - use "localhost" or a dot (".") to specify the local computer explicitly.

Type:String[]
Position:Named
Default value:.
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of the virtual network adapter to be disconnected.

Type:String[]
Position:2
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Passthru

Specifies that a Microsoft.Virtualization.Powershell.VMNetworkAdapter object is to be passed through to the pipeline representing the virtual network adapter to be disconnected.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Outputs

None by default; Microsoft.Virtualization.Powershell.VMNetworkAdapter if -PassThru is specified.