Friday, May 22, 2015

Rename 1000s of Portgroups on 1000s of hosts

#Rename PortGroups
#MrAmbig
#Below is a more specific one
#Get-Datacenter "DC" | Get-Cluster "Cluster" | Get-VMHost | Get-VirtualPortGroup -Name "oldname" | Set-VirtualPortGroup -Name "newname" -vlanid 108
#Below is a shotgun method where all hosts in a vcenter with that portgroup will renamed to your portgroup
Get-VMHost | Get-VirtualPortGroup -Name "oldname" | Set-VirtualPortGroup -Name "newname"