Get-VMSwitch

Gets virtual switches from one or more virtual Hyper-V hosts.

Syntax

Get-VMSwitch
   [[-Name] <String>]
   [[-ResourcePoolName] <String[]>]
   [-ComputerName <String[]>]
   [-SwitchType <VMSwitchType[]>]
Get-VMSwitch
   [[-Id] <Guid[]>]
   [[-ResourcePoolName] <String[]>]
   [-ComputerName <String[]>]
   [-SwitchType <VMSwitchType[]>]

Description

The Get-VMSwitch gets the virtual switches from a Hyper-V host. If you specify no parameters, this cmdlet returns all virtual switches from the local Hyper-V host.

Examples

Example 1

PS C:\>Get-VMSwitch

Gets all virtual switches from the local Hyper-V host.

Example 2

PS C:\>Get-VMSwitch -SwitchType External

Gets all virtual switches that connect to the external network.

Optional Parameters

-ComputerName

Specifies one or more Hyper-V hosts from which virtual switches are to be retrieved. 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
-Id

Specifies the unique identifier of the virtual switch to be retrieved.

Type:Guid[]
Position:1
Default value:None
Accept pipeline input:True (ByValue, ByPropertyName)
Accept wildcard characters:False
-Name

Specifies the name of the virtual switch to be retrieved.

Type:String
Position:1
Default value:None
Accept pipeline input:False
Accept wildcard characters:True
-ResourcePoolName

Specifies the resource pool from which the virtual switches are to be retrieved.

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

Specifies the type of the virtual switches to be retrieved. Allowed values are External, Internal, and Private.

Type:VMSwitchType[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:True

Outputs

Microsoft.Virtualization.Powershell.EthernetSwitch