(2017-02-27)
Port Groups using vCLI
export VI_SERVER=vcenter.domain.local
for i in 0 1 2 3 4 5 6; do
esxcli --vihost esxihost-0$i network vswitch standard portgroup list
done
If you can do that, you’ll be able to add new VLANs (called “port groups” in the vCLI nomenclature) to vSwitches from the command line, like this:
export VI_SERVER=vcenter.domain.local
for i in 0 1 2 3 4 ; do
esxcli --vihost esxihost-0$i network vswitch standard portgroup add -v vSwitch2 -p BeerCan-204
esxcli --vihost esxihost-0$i network vswitch standard portgroup set -p BeerCan-204 -v 204
done
for i in 5 6 ; do
esxcli --vihost esxihost-0$i network vswitch standard portgroup add -v vSwitch1 -p BeerCan-204
esxcli --vihost esxihost-0$i network vswitch standard portgroup set -p BeerCan-204 -v 204
done