VMware Cloud Community
vivari
Enthusiast
Enthusiast

Changing vcloud vm network connection to another orgvdc network

HI ,

I am using below command to change vm network  orgvdc connection from one network to another but its failing with below error, not sure what was i missing.

Get-CIVM -name "ftp" | where {$_.orgvdc.name -eq "XXXXXXXXXXXXXXX"} | Get-CINetworkAdapter | Set-CINetworkAdapter -VAppNetwork "XXXXXXXXX" -IPAddressAllocationMode Manual -IPAddress X.X.X.X -Connected $true

**********************************************************************************************************************************************************************************************************************

Set-CINetworkAdapter : 2020-10-11 10:58:38      Set-CINetworkAdapter            The specified parameter 'VAppNetwork' ex

pects a single

value, but your name criteria 'XXXX-VLAN-XXX' corresponds to multiple values.

At line:1 char:110

+ ... rkAdapter | Set-CINetworkAdapter -VAppNetwork "XXXXX-VLAN-XXX" -IPA ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidResult: (System.Collecti...dObjectInterop]:List`1) [Set-CINetworkAdapter], VimExc

   eption

    + FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_MoreResultsThanExpected,VMware.VimAutomation.Clo

   ud.Commands.Cmdlets.SetCINetworkAdapter

Set-CINetworkAdapter : 2020-10-11 10:58:38      Set-CINetworkAdapter            CIVAppNetwork parameter: Could not find

any of the obj

ects specified by name.

At line:1 char:110

+ ... rkAdapter | Set-CINetworkAdapter -VAppNetwork "XXXX-VLAN-XXX" -IPA ...

+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ObjectNotFound: (VMware.VimAutom...ork VAppNetwork:RuntimePropertyInfo) [Set-CINetworkAd

   apter], ObnRecordProcessingFailedException

    + FullyQualifiedErrorId : Core_ObnSelector_SetNewParameterValue_ObjectNotFoundCritical,VMware.VimAutomation.Cloud.

   Commands.Cmdlets.SetCINetworkAdapter

0 Kudos
1 Reply
LucD
Leadership
Leadership

Have you looked at Example 1 of the Set-CINetworkAdapter cmdlet?

I'm not sure you can use a String as a value for the VAppNetwork parameter.


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

0 Kudos