Set Guest Customization
If vSphere APIs begin with /rest (vs /api), any maps are consumed/returned instead as arrays of objects, each containing a key and a value property field.
Applies a customization specification in spec on the virtual machine in vm. This operation only sets the specification settings for the virtual machine. The actual customization happens inside the guest when the virtual machine is powered on. If spec has unset values, then any pending customization settings for the virtual machine are cleared. If there is a pending customization for the virtual machine and spec has valid content, then the existing customization setting will be overwritten with the new settings.
Request
URLURL
https://{api_host}/rest/vcenter/vm/{vm}/guest/customization
Parameters
Parameters
string
vm
Required
The unique identifier of the virtual machine that needs to be queried.
The parameter must be an identifier for the resource type: VirtualMachine.
Header Parameters
Header Parameters
string
vmware-api-session-id
Required
Required session ID, obtained by first calling Create Session API
Example: b00db39f948d13ea1e59b4d6fce56389
Request Body
Request Body
VmGuestCustomizationSetRequestBody of type application/json (required){
"spec": {
"name": "string",
"spec": {
"configuration_spec": {
"linux_config": {
"domain": "string",
"hostname": {
"fixed_name": "string",
"prefix": "string",
"type": "enum"
},
"script_text": "string",
"time_zone": "string"
},
"windows_config": {
"reboot": "enum",
"sysprep": {
"domain": {
"domain": "string",
"domain_password": "string",
"domain_username": "string",
"type": "enum",
"workgroup": "string"
},
"gui_run_once_commands": [
"string"
],
"gui_unattended": {
"auto_logon": false,
"auto_logon_count": 0,
"password": "string",
"time_zone": 0
},
"user_data": {
"computer_name": {
"fixed_name": "string",
"prefix": "string",
"type": "enum"
},
"full_name": "string",
"organization": "string",
"product_key": "string"
}
},
"sysprep_xml": "string"
}
},
"global_DNS_settings": {
"dns_servers": [
"string"
],
"dns_suffix_list": [
"string"
]
},
"interfaces": [
{
"adapter": {
"ipv4": {
"gateways": [
"string"
],
"ip_address": "string",
"prefix": 0,
"type": "enum"
},
"ipv6": {
"gateways": [
"string"
],
"ipv6": [
{
"ip_address": "string",
"prefix": 0
}
],
"type": "enum"
},
"windows": {
"dns_domain": "string",
"dns_servers": [
"string"
],
"net_BIOS_mode": "enum",
"wins_servers": [
"string"
]
}
},
"mac_address": "string"
}
]
}
}
}
spec
Required
The customization settings to be applied to the guest operating system.
cURL Command
curl -X PUT -H "vmware-api-session-id: b00db39f948d13ea1e59b4d6fce56389" -H "Content-Type: application/json" -d '{"spec":{"name":"string","spec":{"configuration_spec":{"linux_config":{"domain":"string","hostname":{"fixed_name":"string","prefix":"string","type":"enum"},"script_text":"string","time_zone":"string"},"windows_config":{"reboot":"enum","sysprep":{"domain":{"domain":"string","domain_password":"string","domain_username":"string","type":"enum","workgroup":"string"},"gui_run_once_commands":["string"],"gui_unattended":{"auto_logon":false,"auto_logon_count":0,"password":"string","time_zone":0},"user_data":{"computer_name":{"fixed_name":"string","prefix":"string","type":"enum"},"full_name":"string","organization":"string","product_key":"string"}},"sysprep_xml":"string"}},"global_DNS_settings":{"dns_servers":["string"],"dns_suffix_list":["string"]},"interfaces":[{"adapter":{"ipv4":{"gateways":["string"],"ip_address":"string","prefix":0,"type":"enum"},"ipv6":{"gateways":["string"],"ipv6":[{"ip_address":"string","prefix":0}],"type":"enum"},"windows":{"dns_domain":"string","dns_servers":["string"],"net_BIOS_mode":"enum","wins_servers":["string"]}},"mac_address":"string"}]}}}' https://{api_host}/rest/vcenter/vm/{vm}/guest/customization
Errors
400
com.vmware.vapi.std.errors.invalid_argument : if the customization settings in spec are not valid.
401
com.vmware.vapi.std.errors.unauthenticated : if the user can not be authenticated. | com.vmware.vapi.std.errors.unauthorized : if the user doesn't have the required privileges.
404
com.vmware.vapi.std.errors.not_found : if a customization specification is not found with the unique name in spec.
If the virtual machine vm is not found.
409
com.vmware.vapi.std.errors.not_allowed_in_current_state : if the virtual machine vm is not in a powered off state.
503
com.vmware.vapi.std.errors.service_unavailable : if the system is unable to communicate with a service to complete the request.