VMware Cloud Community
CSIEnvironments
Enthusiast
Enthusiast
Jump to solution

Setting Guest Customization Section Fails in 5.5

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!

1 Solution

Accepted Solutions
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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.

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com

View solution in original post

Reply
0 Kudos
12 Replies
CRad14
Hot Shot
Hot Shot
Jump to solution

Could it be that $vm.ExtensionData.GetGuestCustomizationSection()   is not getting populated correctly? Could it be it is empty?

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
Reply
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast
Jump to solution

$vm.ExtensionData.GetGuestCustomizationSection() is populated with most of the correct values...


Anyone know whats going on?

Reply
0 Kudos
CNI0
Enthusiast
Enthusiast
Jump to solution

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???

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee
Jump to solution

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.

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast
Jump to solution

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.

alanrenouf
VMware Employee
VMware Employee
Jump to solution

Just confirming where the issue lies at the moment, yeah please can you send me the SR so I can update it.  Thanks

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast
Jump to solution

Here it is:Support Request # 14461824204

Regards,

Dean

alanrenouf
VMware Employee
VMware Employee
Jump to solution

Thanks

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
CNI0
Enthusiast
Enthusiast
Jump to solution

I will verify the workaround monday. I have also filed a SR 14461770804 on this issue

Reply
0 Kudos
CNI0
Enthusiast
Enthusiast
Jump to solution

The workaround works for me to Smiley Happy

Reply
0 Kudos
CSIEnvironments
Enthusiast
Enthusiast
Jump to solution

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?

gcjnalley
Contributor
Contributor
Jump to solution

$guest.any = $null

works excellently for me. Thanks!

Reply
0 Kudos