Get-VirtualSwitch
This cmdlet retrieves the virtual switches associated with a virtual machine host or used by a virtual machine. At least one of the VMHost and VM parameters must be provided. The VM, VMHost, Name parameters do not accept string values through a pipeline because of collision. To specify a server different from the default one, use the Server parameter.
Syntax
Parameters
Required | Parameter Name | Type | Position | Features | Description |
---|---|---|---|---|---|
required
|
Id | String[] | named |
|
Specifies the IDs of the virtual switches you want to retrieve. Note: When a list of values is specified for the Id parameter, the returned objects would have an ID that matches exactly one of the string values in that list. |
optional | ProgressAction | ActionPreference | named |
|
|
optional | Server | VIServer[] | named |
|
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is provided or $null value is passed to this parameter, the command runs on the default servers. For more information about default servers, see the description of Connect-VIServer. |
Output
VMware.VimAutomation.ViCore.Types.V1.Host.Networking.VirtualSwitchBaseExamples
Example 1
Get-VirtualSwitch -VM VM
Retrieves the virtual switch used by the virtual machine named VM.
Example 2
Get-Datacenter -Name "MyDatacenter" | Get-VirtualSwitch
Retrieves all virtual switches in the specified datacenter.
Example 3
Get-VMHost -Name "MyVMHost" | Get-VirtualSwitch
Retrieves all virtual switches on the specified host.
Example 4
Get-VirtualSwitch -Name "vSwitch0"
Retrieves all virtual switches named "vSwitch0".
Related Commands
VirtualSwitch
This cmdlet retrieves the virtual switches associated with a virtual machine host or used by a virtual machine.
This cmdlet creates a new virtual switch.
This cmdlet removes the specified virtual switches from their locations.
This cmdlet modifies the properties of the specified virtual switch.
VirtualSwitchPhysicalNetworkAdapter
This cmdlet adds a host physical NIC to a standard virtual switch.
This cmdlet removes the specified host physical NICs from the standard virtual switch.