Thursday, July 19, 2012

One-liner to update virtual port group label on a ESX

I am publishing this here for reference because I couldn' t find what I needed elsewhere on the Web. This is a Powershell one-liner to update the virtual port group label on a specific ESX host:

Get-VirtualPortGroup -VMHost "esxhostname" |
  ?{$_.name -like "old_label"} |
  Set-VirtualPortGroup -Name "new_label"-Confirm:$false
 
Just be aware that any VM running on this ESX host and bound to this network label will immediately loose its connection. To prevent this and change the network label for the virtual machines, check the first script showed in this post here, which you should run just after mine.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...