VMware Cloud Community
ESXNT
Contributor
Contributor
Jump to solution

Renaming a Virtual Group Name

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 Smiley Happy

Thanks!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

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

ESXNT
Contributor
Contributor
Jump to solution

That was it.

Thanks!!

0 Kudos