MaxYakunin
Contributor
Contributor

vCloud Director - Configure "Guest Properties" OVF descriptors.

Hi,

I'm trying to automate some task using OVF descriptors, located in "Guest Properties". For the starting point i used following post Example for configuring VM's "guest properties" (i.e. OVF settings)​ (pretty old post so i started a new thread). In the script author sets field "value", but i found that values appears in OvfPropertyConfigurationValue field that contains an array (it doesn’t matter, the error is the same in both cases, but just in case I mention it). I modified the script a bit and now it looks like this:

# Search for the guest properties section (OVF settings) - this is called "product section" in the API/CLI

$vm = Get-CIVM -Name 'Test'

$vmProductSection = $vm.ExtensionData.GetProductSections() 

$vsa = $vmProductSection.ProductSection[0] 

# Set the value of individual properties 

(($vsa.Items | Where-Object {$_.key -eq 'TestField1'})[0]).OvfPropertyConfigurationValue[0].Value = 'once' 

(($vsa.Items | Where-Object {$_.key -eq 'TestField2'})[0]).OvfPropertyConfigurationValue[0].Value = 'AGAIN' 

# Commit the changes 

$vmProductSection.UpdateServerData()

Values for fields are set correctly, but commiting changes fails with the folloing error:

Exception calling "UpdateServerData" with "0" argument(s): "Unable to cast object of type 'VMware.VimAutomation.Cloud.Schema.Msg_Type' to type 'VMware.VimAutomation.Cloud.Schema.VCloudExtensibleType'."

Please, help solve the problem.

0 Kudos
0 Replies