Home > Blogs > VMware PowerCLI Blog > Tag Archives: Get-VirtualSwitch

Tag Archives: Get-VirtualSwitch

Enhanced Support for Distributed Switches in PowerCLI 4.1.1

Support for managing distributed switches was initially introduced in PowerCLI 4.1. In PowerCLI 4.1.1,  we extend this functionality by making changes to the following cmdlets:

Returns both standard and distributed switches. You can filter the retrieved switches by their type.
Returns the virtual port groups of the specified standard and distributed switches.
You can retrieve the hosts that are connected to a specific distributed switch.
You can retrieve the virtual machines that are connected to a specific distributed switch.
You can retrieve the host network adapters that are connected to a specific distributed switch.
New-NetworkAdapter, Set-NetworkAdapter
You can attach network adapters to a specific Port Id of the distributed switch.


By using PowerCLI cmdlets, you can migrate virtual machines and hosts between distributed virtual switches, and also create various reports related to distributed switches.


To list all distributed switches available in the vCenter Server, you can just run the Get-VirtualSwitch cmdlet:

The port groups on the distributed switch are also easy to retrieve:

If you need to get the hosts connected to the distributed switch, just filter them by using the Get-VMHost cmdlet:

Even more, you can check which host network adapters are connected to a specific distributed switch:

To check which virtual machines are part of a distributed switch network, use the DistributedSwitch parameter of the Get-VM cmdlet: