Today we configured a new VLAN on the physical switches, now we need to configure a portgroup with vlan id on multiple ESX hosts in our cluster. To do this by hand it will cost 3 minutes per host, to script this.. you configure this in 10 seconds!

The script:

Get-Cluster “clustername” | Get-VMHost | Get-VirtualSwitch -Name “vSwitch0″ | New-VirtualPortGroup -Name “VLAN-23-Citrix Provisioning” -VLanId 23

VMware: Add PortGroup to all hosts in cluster with PowerCLI_PortGroup

VMware: Add PortGroup to all hosts in cluster with PowerCLI_PortGroup_02