The GuestCustomizationSection element includes a customization script and other parameters that are applied when you customize a virtual machine.

The GuestCustomizationSection includes predefined property names that VMware guest customization tools recognize. Certain values in this element, if omitted or left empty, are inherited from the OrgGuestPersonalizationSettings of the organization that owns the virtual machine. See Retrieve or Update Organization Settings.

The vCloud API also supports use of the ovf:ProductSection to pass an arbitrary set of key=value pairs to a vApp or virtual machine through the ovf:Environment element. See Retrieve or Modify ProductSection Elements.

This operation requires the rights included in the predefined vApp Author role or an equivalent set of rights.

1

Retrieve the GuestCustomizationSection to modify.

Make a GET request to the URL in the section's href attribute value.

GET https://vcloud.example.com/api/vApp/vm-12/guestCustomizationSection/
2

Modify the retrieved section.

Request bodies must contain all required elements and attributes, even if you are not changing their values. Because optional elements and attributes typically revert to default values if they are omitted or empty, it is a best practice to include optional elements in request bodies that modify existing objects. Link elements and href attributes from responses do not need to be included in modified sections. Some elements and attributes are read-only and cannot be modified. See the schema reference for details.

3

Update the section with your modifications.

a

In the retrieved section, find the Link element where rel="edit".

b

Make a PUT request to the URL in that link's href attribute value, and supply the modified section as the request body.

The response to this request is a Task element that tracks the update operation. When the task is complete, the section is updated.

The modified section replaces the contents of the original section. For some section types, modifications take effect immediately. For others, modifications take effect only after a power or deployment state change.

This request specifies guest customization values, including the information required to join the virtual machine to a Windows domain.

Note

If you include a CustomizationScript, it cannot exceed 49,000 characters.

Request:

PUT https://vcloud.example.com/api/vApp/vm-12/guestCustomizationSection/
Content-type: application/vnd.vmware.vcloud.guestcustomizationsection+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<GuestCustomizationSection
   xmlns="http://www.vmware.com/vcloud/v1.5"
   xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"
   ovf:required="false">
   <ovf:Info>Specifies Guest OS Customization Settings</ovf:Info>
   <Enabled>true</Enabled>
   <ChangeSid>true</ChangeSid>
   <VirtualMachineId>12</VirtualMachineId>
   <JoinDomainEnabled>false</JoinDomainEnabled>
   <UseOrgSettings>false</UseOrgSettings>
   <DomainName>example</DomainName>
   <DomainUserName>admin</DomainUserName>
   <DomainUserPassword>Pa55w0rd</DomainUserPassword>
   <AdminPasswordEnabled>true</AdminPasswordEnabled>
   <AdminPasswordAuto>true</AdminPasswordAuto>
   <AdminPassword />
   <ResetPasswordRequired>false</ResetPasswordRequired>
   <CustomizationScript />
   <ComputerName>Win2K3</ComputerName>
</GuestCustomizationSection>

Response:

202 Accepted
Content-Type: application/vnd.vmware.vcloud.task+xml
...
<Task
   ... 
   operation="Updating Virtual Application Win2K3 (12)"
   ...>
   ...
</Task>