Guest Operating System Customization

You can use the vSphere Web Services SDK to customize several attributes of the guest operating system. The
CustomizationSpec
data object allows you to specify network and identity settings in the guest operating system.
Use the
CustomizationSpec
data object to specify the settings that you choose to modify. You can specify the following areas:
  • IP addresses and gateway addresses for virtual NIC devices
  • DNS servers
  • Virtual hostname
  • Domain name
  • Time zone
You can customize a guest operating system while the virtual machine is stopped, by invoking the
VirtualMachine.CustomizeVM_Task
method. You can customize the guest operating system while the virtual machine is running, by invoking the
VirtualMachineGuestCustomizationManager.CustomizeGuest_Task
method. The instant clone feature requires that you customize the virtual machine while it is running. To initialize a virtual machine for a cloud environment, you must customize the virtual machine while it is stopped.
The two ways to customize a virtual machine are compared in the following table.
Comparing Guest Operating System Customization
Customization While Stopped
Instant Clone Customization
vSphere Compatibility
  • vSphere 5 and later
  • Both vSphere and VMC
  • vSphere 7 and later
  • vSphere only (not VMC)
API Method
VirtualMachine.CustomizeVM_Task()
  • VirtualMachineGuestCustomizationManager.CustomizeGuest_Task()
  • VirtualMachineGuestCustomizationManager.StartGuestNetwork_Task()
  • VirtualMachineGuestCustomizationManager.AbortCustomization_Task()
Creating CustomizationSpec
Create customization specifications in vSphere Client or in API.
Create customization specifications in API.
Virtual Machine State
Must be powered off.
Must be powered on.
vmtools
Must be installed.
For Linux cloud-init customization, use open-vm-tools.
Must be installed and running.
cloud-init
Must be installed if using cloud-init customization.
Not used.
Customization Engine
Not used.
Required.
Supported Guests
Linux only. Supported distributions are listed in Customizing Guest Network Settings for Running Virtual Machines.
Network Adapter State
For Sysprep or Linuxprep customization,
CustomizeVM_Task()
disconnects virtual adapters and prepares customization. The next time the virtual machine powers on, the customization will take effect and
vmtools
will reconnect virtual adapters.
For CloudinitPrep customization,
CustomizeVM_Task()
does not disconnect virtual adapters.
InstantClone_Task()
disconnects virtual adapters before creating a clone. Use
StartGuestNetwork()
to restart virtual adapters after customization.
Rebooting the Guest
vmtools
reboots the guest operating system after reconnecting virtual network adapters.
No reboot needed after Linux cloud-init customization, either LinuxPrep or CloudinitPrep.
No reboot needed.
StartGuestNetwork()
restarts network services after customization.