Hi,
Since migrating to vCloud 5.5 the following script fails which worked in 5.1:
$CIVMs = get-CIvApp $CIvAppName | get-civm
Foreach ($vm in $CIVMs) {
write-host "Customizing" $vm.name
$GuestCustomization = $vm.ExtensionData.GetGuestCustomizationSection()
$GuestCustomization.Enabled = $true
$GuestCustomization.ChangeSid = $false
$GuestCustomization.ComputerName = $vm.name
$GuestCustomization.ResetPasswordRequired = $false
$GuestCustomization.AdminPasswordEnabled = $false
$GuestCustomization.UpdateServerData()
}
The error is the following:
Exception calling "UpdateServerData" with "0" argument(s): "Bad request - Unexpected JAXB Exception -
cvc-complex-type.2.4.a: Invalid content was found starting with element 'AdminAutoLogonEnabled'. One of
'{"http://www.vmware.com/vcloud/v1.5":Link, WC[##other:"http://www.vmware.com/vcloud/v1.5"]}' is expected."
At line:10 char:1
+ $GuestCustomization.UpdateServerData()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CloudException
Any ideas?
Thanks!
Please can you try telling PowerCLI to use the 5.1 API by using the following code in your script before you run the cmdlet:
[VMware.VimAutomation.Cloud.Views.CloudClient]::ApiVersionRestriction.ForceCompatibility("5.1")
Let me know if it helps.
Could it be that $vm.ExtensionData.GetGuestCustomizationSection() is not getting populated correctly? Could it be it is empty?
$vm.ExtensionData.GetGuestCustomizationSection() is populated with most of the correct values...
Anyone know whats going on?
Hi
I have the exact same problem after upgrade from vCD 5.1 to 5.5u1.(and Powercli 5.5 R2)
I can reproduce the problem as simple as this:
$civapp = get-civapp "MyVapp"
$civm = $civapp | get-civm
$guest = $civm.ExtensionData.GetGuestCustomizationSection()
$guest.UpdateServerData()
Exception calling "UpdateServerData" with "0" argument(s): "Bad request - Unex
pected JAXB Exception - cvc-complex-type.2.4.a: Invalid content was found star
ting with element 'AdminAutoLogonEnabled'. One of '{"http://www.vmware.com/vclo
ud/v1.5":Link, WC[##other:"http://www.vmware.com/vcloud/v1.5"]}' is expected."
At line:1 char:1
+ $guest.UpdateServerData()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : CloudException
Any ideas whats wrong???
Please can you try telling PowerCLI to use the 5.1 API by using the following code in your script before you run the cmdlet:
[VMware.VimAutomation.Cloud.Views.CloudClient]::ApiVersionRestriction.ForceCompatibility("5.1")
Let me know if it helps.
Thanks Alan, that worked. Is that a bug or expected behaviour? If a bug I have logged an SR for it today if you would like it.
Regards.
Just confirming where the issue lies at the moment, yeah please can you send me the SR so I can update it. Thanks
Here it is:Support Request # 14461824204
Regards,
Dean
Thanks
I will verify the workaround monday. I have also filed a SR 14461770804 on this issue
The workaround works for me to
Just another update to this....This works as well:
$civapp = get-civapp "Dev Ops 2*"
$civm = $civapp | get-civm BingoGS1
$guest = $civm.ExtensionData.GetGuestCustomizationSection()
$guest.any = $null
$guest.UpdateServerData()
Adding $guest.any = $null works without having to force an API version. Any ideas on why that is Alan?
$guest.any = $null
works excellently for me. Thanks!