With the release of vSphere 5.0 and 5.1 I have seen people become more confident with using the vSphere Distributed Switch (VDS), this is probably due to some of the great new features that make the switch not only easier to manage but also less error prone when configuring, more manageable from the backup/restore point of view and top this off with some great new features and I can see why people are moving to the VDS from other existing visualized switching configurations.

Some great examples of these additions can be found here:

On the operational aspects of networking other network switches can have a CLI to manage them, people who are moving to the VDS often wonder what options are available to them and how they can give access to the networking team to manage their networking environment.

With the introduction of PowerCLI 5.1 R2 we added a VDS Snap-in, this means we can now manage the VDS with PowerCLI but of course other areas of operational management already existing in PowerCLI with the existing vSphere cmdlets.  Whilst this is not a complete replacement for the well known networking CLIs this is certainly a place that I have seen some network admins move to and once they learn the differences they are surprised by the ease of use and the quick results they can achieve.

To show some of the ease of use and power I put together some specific code examples based around networking:

List the commands for working with VDS


List all VMs and their Network Portgroup and Mac Address

Get-VM | Get-NetworkAdapter | Select Parent, Name, NetworkName, MacAddress

Export the configuration of a specified port group to file

Get-VDPortGroup -Name ‘DHCP01’ | Export-VDPortGroup -Destination ‘C:\MyVDSwitchesBackup\’

List all Portgroups and their relevant information

Get-VDPortgroup | Select Name, VirtualSwitch, Datacenter, VlanConfiguration, NumPorts, PortBinding

List the vSwitches and their main properties

Get-VDSwitch | Select *

Create a new distributed port group on the specified vSphere distributed switch with the specified number of ports and VLAN ID

Get-VDSwitch -Name “Test-VDS” | New-VDPortgroup -Name “PG_VLAN4” -NumPorts 8 -VLanId 4

Switch settings can be altered with the Set-VDSwitch cmdlet, an example of this is how to enable link discovery protocol on a specified vSphere distributed switch, set it to LLDP and change the link discovery protocol operation to listen.

$myVDSwitch = Get-VDSwitch -Name “Test-VDS”
Set-VDSwitch -VDSwitch $myVDSwitch -LinkDiscoveryProtocol LLDP -LinkDiscoveryProtocolOperation Listen

Modify the maximum number of ports, the number of uplink ports, and the maximum MTU size of the specified vSphere distributed switch.

Get-VDSwitch -Name “Test-VDS” | Set-VDSwitch -MaxPorts 1000 -NumUplinkPorts 8 -Mtu 2000

Change the name, number of ports and the VLAN ID of all distributed port groups named “MyVDPortGroup”

Get-VDPortgroup -Name “PG_VLAN4” | Set-VDPortgroup -Name “PG_VLAN5” -NumPorts 5 -VlanId 5

If your network team has reservation around moving to the VDS, I strongly advise getting them to take a look at PowerCLI to see what they can achieve and remember, with the .Extensiondata property and the Get-View cmdlet they can open up the entire API for VDS and achieve the parts that there is currently not a cmdlet for.