Customizing the Guest Operating System

You install the guest operating system on the virtual machine just as you would install it on a physical machine. Afterwards, you can use the Web Services API to retrieve information and perform some customization if VMware Tools is installed on top of the guest operating system.

VirtualMachine includes the following methods for managing the guest operating system:

  • ShutdownGuest and RebootGuest shut down and reboot the guest OS, and StandbyGuest puts the guest in hybernate mode. In each case, you perform the action on the guest OS. For example, you might shut down Windows but leave the virtual machine running.
  • ResetGuestInformation clears cached guest information. Guest information can be cleared only if the virtual machine is powered off. Use this method if stale information is cached, preventing reuse of an IP address or MAC address.
  • SetScreenResolution sets the console screen size of the guest operating system. When you call this method, the change is reflected immediately the virtual machine console you can access in the vSphere Client.

You can customize the identity and network settings of the guest OS with the CustomizationSpec data object that is a parameter to VirtualMachine.CustomizeVM_Task. The CustomizationSpec is also a property of the VirtualMachineCloneSpec you pass in when cloning a virtual machine.

The settings you customize with this method are primarily virtual machine settings, but because the virtual machine and the guest OS share the information, you are also customizing the guest OS with this method.

The CustomizationSpec allows you to set the following properties:

  • encryptionKey – Array of bytes that can be used as the public key for encrypting passwords of administrators.
  • globalIPSettings – Contains a CustomizationGlobalIPSettings data object which specifies a list of DNS servers and a list of name resolution suffixes for the virtual network adapter.
  • identity – Allows you to specify the network identity and settings, similar to the Microsoft Sysprep tool.
  • nicSettingMap – Custom IP settings that are specific to a particular virtual network adapter.
  • options – Optional operations (either LinuxOptions or WinOptions).