Rename vswitch portgroups using PowerCli

Rename vswitch portgroups using PowerCli

Rename vswitch portgroups using PowerCli

Rename vswitch portgroups PowerCli – Here’s a quick and easy way to rename all port groups on a specific vSwitch on all hosts in a  vSphere cluster using PowerCli.

Esxi_pfs_5_5a

Do remember to establish a connection to your vCenter server via the below powercli one liner.

The Below function accepts two parameters which comprises of a single vSphere cluster name and also the multiple values of the vSwitch name.

As you can make out from the function it extracts all the VMhosts from the vSphere cluster name, next for each of these hosts gets the standard virtual switch which match the input parameter vSwitch name to the cluster, next it gets the virtual port groups for the vswitch, and for each of them goes ahead and renames them with the required name, here in my example, i am adding a prefix “dr_” in front of the virtualportgroup name.

To execute this function, just copy paste the above code to a powershell console, and invoke the function.

Rename vswitch portgroups with PowerCli

PowerCli Rocks!!

PowerCLI

Just imagine how much time it would take you to perform this task manually on 8 node cluster with 8 hosts each :)?, maybe a week !

I hope you enjoyed this blogpost on “Rename vswitch portgroups using PowerCli” and found this information useful.

Please follow and like us:

Share this post

Post Comment