LucD
Leadership
Leadership

Try this, it should do the trick.

$hostname = <ESX-hostname>
$vswitch = <vSwitch-name>
$pgname = <old-PortgroupName>
$newpgname = <new-PortgroupName>

$net = Get-View (Get-VMHost $hostname | Get-View).configManager.networkSystem

foreach($pg in $net.NetworkInfo.Portgroup){
  if($pg.Spec.VswitchName -eq $vswitch -and $pg.spec.Name -eq $pgname){
    $spec = $pg.Spec
  }
}
$spec.name = $newpgname
$net.UpdatePortGroup($pgName,$spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos