Hello All,
Im trying to rename virtual switches that were previously migrated.
during migration they were added with a "(1)" in their names.
Im trying to rename them using PowerCLI 11.2.0.12483638.
$PortGroups = Get-VirtualPortGroup -Name "*(1)*" | ? {$_.name -eq "Vlan999 (1)"}
foreach ($PortGroup in $PortGroups)
{
$NewName = $PortGroup.name.Replace(" (1)","-CHI")
Get-VirtualPortGroup -name $PortGroup.name
Set-VirtualPortGroup -VirtualPortGroup $PortGroup -name $newname
}
while trying to rename a Virtual Port Group, i get the following error:
Cannot bind parameter 'VirtualPortGroup'
Cannot convert the "Vlan999 (1)" value of type
"VMware.VimAutomation.ViCore.Impl.V1.Host.Networking.DistributedPortGroupImpl" to type "VMware.VimAutomation.ViCore.Types.V1.Host.Networking.VirtualPortGroup"
I have even tried without a foreach loop (directly piping the output object from Get-VirtualPortGroup to Set-VirtualPortGroup):
Get-VirtualPortGroup -Name "Vlan999 (1)" | Set-VirtualPortGroup -Name "VLAN999-CHI"
But for some reason, Get-VirtualPortGroup is outputting an object which cannot be parsed by Set-VirtualPortGroup:
Set-VirtualPortGroup : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its
properties do not match any of the parameters that take pipeline input.
Anyone has any input on this?
I can use your help
Thanks!
You are working with VDS, not VSS.
Use the Set-VDPortgroup instead.
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You are working with VDS, not VSS.
Use the Set-VDPortgroup instead.
---------------------------------------------------------------------------------------------------------
Was it helpful? Let us know by completing this short survey here.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That was it.
Thanks!!