You can create and manage customization specifications for Windows and Linux guest operating systems. Customization specifications are XML files that contain guest operating system settings for virtual machines. When you apply a specification to the guest operating system during virtual machine cloning or deployment, you prevent conflicts that might result if you deploy virtual machines with identical settings, such as duplicate computer names.

vCenter Server saves the customized configuration parameters in the vCenter Server database. If the customization settings are saved, the administrator and domain administrator passwords are stored in encrypted format in the database. Because the certificate used to encrypt the passwords is unique to each vCenter Server system, if you reinstall vCenter Server or attach a new instance of the server to the database, the encrypted passwords become invalid. You must reenter the passwords before you can use them.

To learn how you can create and manage customization specifications in the vSphere Client, watch the following video.

Create a Customization Specification for Linux

Save the system settings for a Linux guest operating system in a customization specification, which you can apply when cloning virtual machines or deploying virtual machines from templates. You can use the cloud-init utility as a standardized way to initialize a virtual machine when you deploy it in a cloud environment.

Prerequisites

  • Verify that all requirements for customization are met. See Guest Operating System Customization Requirements.
  • To run the customization script:
    • Verify that VMware Tools version 10.1.0 or later is installed. The customization fails if VMware Tools is version earlier than 10.1.0 and you attempt to run the customization script.
    • In the VMware Tools configuration, the enable-custom-scripts option is deactivated by default for security reasons. When you attempt to run the customization script with a deactivated enable-custom-scripts option, the customization fails with a customization error.
      For example, to enable the enable-custom-scripts option, you must run vmware-toolbox-cmd as a root user with the config command:
      vmware-toolbox-cmd config set deployPkg enable-custom-scripts true
      cat /etc/vmware-tools/tools.conf
      [deployPkg]
      enable-custom-scripts = true
      To verify that you set the option correctly, you can run the following command:
      vmware-toolbox-cmd config get deployPkg enable-custom-scripts
      [deployPkg] enable-custom-scripts = true

      For more information, see the VMware Tools User Guide.

  • To customize the guest operating system of a virtual machine with cloud-init metadata and user data:
    • Verify that VMware Tools version 11.3.0 or later is installed.
    • Verify that cloud-init version 21.1 or later is installed.

Procedure

  1. Click the menu icon (Main navigation icon) and click Policies and Profiles.
  2. Click VM Customization Specifications.
  3. To create a specification, from the VM Customization Specifications pane, click New.
    The New VM Guest Customization Specification wizard opens.
  4. On the Name and target OS page, enter a name and a description for the customization specification, and select Linux as a target guest OS.
  5. (Optional) To initiate customization with raw cloud-init data:
    1. Select the Use cloud-init config data check box and click Next.
    2. On the Cloud-init metadata page, apply a cloud-init metadata to the guest operating system of the VM.
      For more information about the metadata and user data format, see the VMware KB article at: https://kb.vmware.com/s/article/82250.
      Option Action
      Upload a cloud-init metadata file

      The cloud-init metadata file is a plain-text in YAML or JSON file format.

      The maximum file size is 512 KB.

      • Click Upload and navigate to the file on your local machine.

        The contents of the file appear in the text box.

      Enter a cloud-init metadata script
      • (Optional) Enter the metadata script directly into the text box.
    3. Click Next.
    4. (Optional) On the Cloud-init user data, apply a cloud-init user configuration to the guest operating system of the VM. For example, you can add a new user to the guest operating system.
      For more information about the cloud-init user data, see the Cloud-init documentation at: https://cloudinit.readthedocs.io/en/latest/topics/format.html.
      Upload a cloud-init user data file

      The cloud-init user data file is a plain-text in raw cloud-init format.

      The maximum file size is 512 KB.

      • Click Upload and navigate to the file on your local machine.

        The contents of the file appear in the text box.

      Enter a cloud-init user data
      • (Optional) Enter the cloud-init user data script directly into the text box.
    5. Click Next.
    6. On the Ready to complete page, review the details and click Finish to save your changes.
  6. (Optional) To initialize traditional customization:
    1. On the Computer name page, enter a computer name for the guest operating system and a domain name.
      The guest operating system uses the computer name to identify itself on the network. On Linux system, it is called the host name.
      Option Action
      Use the virtual machine name Select this option to use the virtual machine name. The computer name that vCenter Server creates is identical to the name of the virtual machine on which the guest operating system is running. If the name exceeds 63 characters, it is truncated.
      Enter a name in the Clone/Deploy wizard Select this option to be prompted to enter a name during cloning or deployment.
      Enter a name
      • Enter a name.

        The name can contain alphanumeric characters and a hyphen (-). It cannot contain a period (.), blank spaces, or special characters, and cannot contain digits only. Names are not case-sensitive.

      • (Optional) To ensure that the name is unique, select the Append a numeric value check box.

        This action appends a hyphen followed by a numeric value to the virtual machine name. The name is truncated if it exceeds 63 characters when combined with the numeric value.

      Generate a name using the custom application configured with vCenter Server Enter a parameter that can be passed to the custom application.
    2. Enter the Domain Name for the computer and click Next.
    3. On the Time zone page, select the time zone for the virtual machine and click Next.
    4. On the Customization script page, apply a customization script to the guest operating system of the VM and click Next.
      Option Action
      Upload a file containing the customization script
      • Click Browse and navigate to the file on your local machine. The contents of the script appear in the Script text box.
      Enter the customization script Enter the customization script directly into the Script text box.
      The customization script cannot exceed 1500 characters.
      Note:

      The default timeout period for the guest customization to complete is set to 100 seconds and includes the time for the script to run when you use a "precustomization" command-line parameter. If you run scripts that take a time exceeding the timeout, the guest customization fails.

      When you add a customization script with the "precustomization" command-line parameter, it is called before the guest customization begins. As a result, the virtual NIC is disconnected and you cannot access the network.

      When you add a customization script with the "postcustomization" command-line parameter, it is called after the guest customization finishes. As a result, the script is scheduled in the initialization process after the virtual machine powers on, the NIC is connected, and you can access the network. The time for the script to run is not included in the default timeout period and you avoid a guest customization failure.

      Customization Script Example
      #!/bin/sh
      if [ x$1 == x"precustomization" ]; then
      echo Do Precustomization tasks
      elif [ x$1 == x"postcustomization" ]; then
      echo Do Postcustomization tasks
      fi 
    5. On the Network page, select the type of network settings to apply to the guest operating system and click Next.
      Option Action
      Use standard network settings
      • Select Use standard network settings so that vCenter Server configures all network interfaces from a DHCP server by using the default settings.
      Manually select custom settings
      • Select a network adapter from the list or add a new one.
      • For the selected NIC, click Edit.

        The Edit Network dialog box opens.

      • To configure the virtual machine to use an IPv4 network, click the IPv4 tab.

        If you select the Prompt the user for an IPv4 address when the specification is used option, vCenter Server prompts for an IP address when you select to apply the customization specification during cloning or deployment. You are also prompted to configure the gateways during cloning and deployment.

      • To configure the virtual machine to use an IPv6 network, click the IPv6 tab.

        If you select the Prompt the user for an address when the specification is used option, vCenter Server prompts for an IP address when you select to apply the customization specification during cloning or deployment. You are also prompted to configure the gateways during cloning and deployment.

      • Click OK
    6. On the DNS settings page, enter DNS server and domain settings.
      The Primary DNS, Secondary DNS, and Tertiary DNS text boxes accept both IPv4 and IPv6 addresses.
    7. On the Ready to complete page, review the details and click Finish to save your changes.

Results

The customization specification that you created is listed in the Customization Specification Manager. You can use the specification to customize virtual machine guest operating systems.

Create a Customization Specification for Windows

Save specific Windows guest operating system settings in a customization specification, which you can apply when cloning virtual machines or deploying from templates.

Note: The default administrator password is not preserved for Windows Server 2008 after customization. During customization, the Windows Sysprep utility deletes and recreates the administrator account on Windows Server 2008. You must reset the administrator password when the virtual machine starts the first time after customization.

Prerequisites

Ensure that all requirements for customization are met. See Guest Operating System Customization Requirements.

Procedure

  1. Select Menu > Policies and Profiles, and under Policies and Profiles, click VM Customization Specifications.
  2. Click the Create a new specification icon.
    The New VM Guest Customization Specification wizard opens.
  3. On the Name and target OS page, enter a name and description for the customization specification and select Windows as a target guest OS.
  4. (Optional) Select the Generate a new security identity (SID) option and click Next.
    A Windows Security ID (SID) is used in some Windows operating systems to uniquely identify systems and users. If you do not select this option, the new virtual machine has the same SID as the virtual machine or template from which it was cloned or deployed.

    Duplicate SIDs do not cause problems when the computers are part of a domain and only domain user accounts are used. However, if the computers are part of a Workgroup or local user accounts are used, duplicate SIDs can compromise file access controls. For more information, see the documentation for your Microsoft Windows operating system.

  5. On the Set Registration Information page, enter the virtual machine owner’s name and organization and click Next.
  6. On the Computer name page, enter a computer name for the guest operating system and a domain name.
    The operating system uses the computer name to identify itself on the network. On Linux systems, it is called the host name.
    Option Action
    Use the virtual machine name Select this option to use the virtual machine name. The computer name that vCenter Server creates is identical to the name of the virtual machine on which the guest operating system is running. If the name exceeds 63 characters, it is truncated.
    Enter a name in the Clone/Deploy wizard Select this option to be prompted to enter a name during cloning or deployment.
    Enter a name
    1. Enter a name.

      The name can contain alphanumeric characters and a hyphen (-). It cannot contain a period (.), blank spaces, or special characters, and cannot contain digits only. Names are not case-sensitive.

    2. (Optional) To ensure that the name is unique, select the Append a numeric value check box.

      This action appends a hyphen followed by a numeric value to the virtual machine name. The name is truncated if it exceeds 63 characters when combined with the numeric value.

    Generate a name using the custom application configured with vCenter Server Optional: Enter a parameter that can be passed to the custom application.
  7. On the Windows license page, provide licensing information for the Windows operating system and click Next.
    Option Action
    For nonserver operating systems Type the Windows product key for the new guest operating system.
    For server operating systems
    1. Type the Windows product key for the new guest operating system.
    2. Select Include Server License Information.
    3. Select either Per seat or Per server.
    4. If you select Per server, enter the maximum number of simultaneous connections for the server to accept.
  8. On the Set Administrator Password page, configure the administrator password for the virtual machine and click Next.
    1. Enter a password for the administrator account and confirm the password by typing it again.
    2. (Optional) Select the Automatically logon as Administrator check box to log users in to the guest operating system as Administrator, and select the number of times to log in automatically.
  9. On the Time zone page, select the time zone for the virtual machine and click Next.
  10. (Optional) On the Run Once page, specify commands to run the first time a user logs in to the guest operating system and click Next.
    See the Microsoft Sysprep documentation for information about RunOnce commands.
  11. On the Network page, select the type of network settings to apply to the guest operating system and click Next.
    • Select Use standard network settings so that vCenter Server configures all network interfaces from a DHCP server by using the default settings.
    • Select Manually select custom settings and configure each network interface yourself.
      1. Select a network adapter from the list or add a new one.
      2. For the selected NIC, click the vertical ellipsis icon and select Edit.

        The Edit Network dialog box opens.

      3. Click the IPv4 tab to configure the virtual machine to use IPv4 network.

        You can configure all the settings at that stage or you can select the Prompt the user for an IPv4 address when the specification is used option. In that case, vCenter Server prompts for an IP address when you select to apply that customization specification during cloning or deployment. With that option, you can also configure the gateways during cloning or deployment.

      4. Click the IPv6 tab to configure the virtual machine to use IPv6 network.

        You can configure all the settings at that stage or you can select the Prompt the user for an address when the specification is used option. In that case, vCenter Server prompts for an IP address when you select to apply that customization specification during cloning or deployment. With that option, you can also configure the gateways during cloning or deployment.

      5. Click the DNS tab to specify DNS server details.
      6. Click WINS to specify primary and secondary WINS server information.
      7. Click OK to close the Edit Network dialog box.
  12. On the Set Workgroup or Domain page, select how the virtual machine participates in the network and click Next.
    Option Action
    Workgroup Enter a workgroup name. For example, MSHOME.
    Windows Server Domain
    1. Enter the domain name.
    2. To add a computer to the specified domain, enter the user name and password for a user account that has permission.
  13. On the Ready to complete page, review the details and click Finish to save your changes.

Results

The customization specification that you created is listed in the Customization Specification Manager. You can use the specification to customize virtual machine guest operating systems.

Create a Customization Specification for Windows Using a Custom Sysprep Answer File

A custom sysprep answer file is a file that stores various customization settings such as computer name, licensing information, and workgroup or domain settings. You can supply a custom sysprep answer file as an alternative to specifying many of the settings in the Guest Customization wizard.

Windows Server 2003 and Windows XP use a text file called sysprep.inf. Windows Server 2008, Windows Vista, and Windows 7 use an XML file called sysprep.xml. You can create these files using a text editor, or use the Microsoft Setup Manager utility to generate them. For more information about how to create a custom sysprep answer file, see the documentation for the relevant operating system.

Important: If you use a custom sysprep answer file to deploy a virtual machine with an operating system Windows Vista or later, you must specify the network customization specifications in the sysprep file. The custom network settings that you configure in the New VM Guest Customization Specification wizard are not applied. For more information, see VMware KB article 1029174 at https://kb.vmware.com/s/article/1029174.

You can prevent Windows from assigning new virtual machines or templates with the same Security IDs (SIDs) as the original virtual machine. Duplicate SIDs do not cause problems when the computers are part of a domain and only domain user accounts are used. However, if the computers are part of a Workgroup or local user accounts are used, duplicate SIDs can compromise file access controls. For more information, see the documentation for your Microsoft Windows operating system.

Prerequisites

Ensure that all requirements for customization are met. See Guest Operating System Customization Requirements.

Procedure

  1. Select Menu > Policies and Profiles, and under Policies and Profiles, click VM Customization Specifications.
  2. Click the Create a new specification icon.
    The New VM Guest Customization Specification wizard opens.
  3. On the Name and target OS page, enter a name and description for the customization specification and select Windows as a target guest OS.
  4. (Optional) Select the Generate a new security identity (SID) option.
    A Windows Security ID (SID) is used in some Windows operating systems to uniquely identify systems and users. If you do not select this option, the new virtual machine has the same SID as the virtual machine or template from which it was cloned or deployed.

    Duplicate SIDs do not cause problems when the computers are part of a domain and only domain user accounts are used. However, if the computers are part of a Workgroup or local user accounts are used, duplicate SIDs can compromise file access controls. For more information, see the documentation for your Microsoft Windows operating system.

  5. Select Use Custom Sysprep Answer File and click Next.
  6. On the Custom sysprep file, select the option to import or create a sysprep answer file and click Next.
    Option Description
    Import a Sysprep answer file Click Browse and browse to the file.
    Create a Sysprep answer file Type the contents of the file in the text box.
  7. On the Network page, select the type of network settings to apply to the guest operating system and click Next.
    • Select Use standard network settings so that vCenter Server configures all network interfaces from a DHCP server by using the default settings.
    • Select Manually select custom settings and configure each network interface yourself.
      1. Select a network adapter from the list or add a new one.
      2. For the selected NIC, click the vertical ellipsis icon and select Edit.

        The Edit Network dialog box opens.

      3. Click the IPv4 tab to configure the virtual machine to use IPv4 network.

        You can configure all the settings at that stage or you can select the Prompt the user for an IPv4 address when the specification is used option. In that case, vCenter Server prompts for an IP address when you select to apply that customization specification during cloning or deployment. With that option, you can also configure the gateways during cloning or deployment.

      4. Click the IPv6 tab to configure the virtual machine to use IPv6 network.

        You can configure all the settings at that stage or you can select the Prompt the user for an address when the specification is used option. In that case, vCenter Server prompts for an IP address when you select to apply that customization specification during cloning or deployment. With that option, you can also configure the gateways during cloning or deployment.

      5. Click the DNS tab to specify DNS server details.
      6. Click WINS to specify primary and secondary WINS server information.
      7. Click OK to close the Edit Network dialog box.
  8. On the Ready to complete page, review the details and click Finish to save your changes.

Results

The customization specification that you created is listed in the Customization Specification Manager. You can use the specification to customize virtual machine guest operating systems.

Manage Customization Specifications

You can edit, duplicate, export, or delete existing specifications.

Procedure

  1. In the vSphere Client, select Menu > Policies and Profiles and click VM Customization Specifications.
  2. Select a customization specification and select your task.
    Option Description
    Edit customization spec You can make changes to the customization spec, such as changing the networking configuration. Click Edit and make the necessary changes.
    Duplicate customization spec If you need a customization specification that is only slightly different from an existing specification, you can use the Customization Specification Manager to create a copy of the existing specification and modify it. For example, you might need to change the IP address or the administrator password.
    Export customization spec You can export customization specifications and save them as .xml files. To apply an exported specification to a virtual machine, import the .xml file using the Import button.
    Delete specification spec You can remove customization specifications to free up storage.

Import a Customization Specification

You can import an existing specification and use the specification to customize the guest operating system of a virtual machine.

Prerequisites

Before you begin, you must have at least one customization specification saved as an xml file located on a file system accessible from the vSphere Client.

Procedure

  1. In the vSphere Client, select Menu > Policies and Profiles and click VM Customization Specifications.
  2. Click the Import icon.
  3. Browse to the .xml file to import, specify a name and optional description, and click OK.

Results

The imported specification is added to the list of customization specifications.