We frequently need to create new virtual port groups on our ESX hosts with VLAN tags which correspond to pre-assigned DHCP scopes. I wrote this PowerShell script to create the new VPG across all hosts.
This assumes that your virtual port group is on a switch called VMSwitch. You could easily modify this to accept parameters from the command-line, rather than being specified in the script.
When it comes to re-naming existing virtual port groups across hosts there doesn’t seem to be an inbuilt cmdlet, instead I wrote a script to delete the old VPG, and create a new one with the same VLAN tag:-
Run it once to check it’s doing what you want, then remove the
-WhatIf tags to run it for real.