PowerCLI to add vlan to vmware cluster


One-liner to add VLANs to the all hosts within vSphere cluster:

Get-Cluster "CIT Cluster" | Get-VMHost | Get-VirtualSwitch -name vSwitch0 | New-VirtualPortGroup -name "Networking - Vlan80" -VLanId 80