Disconnect-VMNetworkAdapter

Disconnect-VMNetworkAdapter

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

Syntax

Parameter Set: Name
Disconnect-VMNetworkAdapter [-VMName] <String[]> [[-Name] <String[]> ] [-ComputerName <String[]> ] [-Passthru] [ <CommonParameters>]

Parameter Set: Obj
Disconnect-VMNetworkAdapter [-VMNetworkAdapter] <VMNetworkAdapter[]> [-Passthru] [ <CommonParameters>]

Detailed Description

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

Parameters

-ComputerName<String[]>

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.

Aliases

none

Required?

false

Position?

named

Default Value

.

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String[]>

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

Aliases

none

Required?

false

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMName<String[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VMNetworkAdapter<VMNetworkAdapter[]>

Specifies the virtual network adapter to be disconnected.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

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

Examples

Example 1

Disconnects virtual network adapter Test1.

PS C:\> Disconnect-VMNetworkAdapter -VMNetworkAdapter Test1

Example 2

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

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