VMware vSphere Customization Specs: Automate VM Deployment from Templates (No More Manual IP/SID)

VMware tutorial - IT technology blog
VMware tutorial - IT technology blog

The Nightmare of “Duplicate SIDs” and Static IPs at Midnight

Deploying a cluster of 20 Windows Server VMs for an urgent project at 2 AM is a test of any Admin’s patience. If you simply clone from a Template, 15 minutes later you’ll have 20 identical virtual machines sharing the same Hostname, IP, and SID (Security Identifier). The result? The Domain Controller refuses to join the machines due to conflicts, and the system throws errors everywhere.

Manually running Sysprep or changing IPs for each machine at that hour is a disaster. While Linux has Cloud-init, VMware vSphere offers a more professional solution: VMware vSphere Customization Specifications.

vCenter intervenes deep into the Guest OS as soon as it’s deployed from a Template. You can automatically set the computer name, configure the network, and reset the SID without opening the VM Console. This method saves about 80% of the time compared to manual operations.

Pre-deployment Checklist (Don’t skip this!)

If these conditions are missing, you’ll immediately get the error message “Customization of the guest operating system is not supported.” Check carefully:

  • VMware Tools: This is a mandatory bridge. The Template must have VMware Tools pre-installed and must be in a Power Off state.
  • vCenter Server: This feature is not supported on standalone ESXi (Free version).
  • Guest OS Compatibility: Most Windows Server versions and popular Linux distros (Ubuntu, CentOS, RHEL) work well.
  • Sysprep: Modern Windows versions have it built-in. For Windows XP or Server 2003, you must manually upload the Sysprep file to vCenter.

Detailed Customization Specification Setup

To start, go to Menu -> Policies and Profiles -> VM Customization Specifications on the vSphere Client.

1. Configuring for Windows (Handling SIDs and Domains)

Here are some field notes when creating a Spec for Windows:

  • Computer Name: Don’t select “Use the virtual machine name.” VM names in vSphere are often long or contain special characters, while Windows NetBIOS is limited to 15 characters. Choose “Enter a name in the deployment wizard.”
  • Administrator Password: Set the local Admin password. I usually choose “Automatically log on as Administrator” once so that initialization scripts can run automatically right after booting.
  • Generate New SID: This is MANDATORY. This runs Sysprep to re-identify the virtual machine within the Active Directory environment.

2. Network Management: Static IP or DHCP?

This is the most valuable part of the Customization Spec. You can assign a static IP without logging into the OS:

  • Select Manually enter settings.
  • In the IPv4 section, select “Prompt the user for an IP address when the specification is used”. This makes the Spec more flexible, allowing you to enter a unique IP for each machine during deployment.
  • Pre-fill the Gateway and DNS Server to avoid repetitive typing.

3. Configuring for Linux (Hostname and DNS)

Linux is simpler because there are no SIDs. vCenter will automatically edit files like /etc/hostname and network configurations (like Netplan on Ubuntu) for you.

# Instead of typing manually for each machine:
hostnamectl set-hostname server-01
sedo -i 's/old/new/g' /etc/hosts
# The Spec will handle this entire process automatically.

Deployment and Monitoring

When performing Deploy VM from Template, at the “Select customization options” step, simply select Customize the operating system and point it to the Spec you created.

Signs of a Successful Process

Don’t panic if the virtual machine reboots 2-3 times. That’s Sysprep doing its job. Monitor the Events tab of the VM in vCenter. When you see the message “Customization succeeded”, it means your VM is ready with its new identity.

If you prefer not to use the mouse, use PowerCLI to create multiple VMs with just a few lines of code:


$vmName = "Web-Srv-01"
$template = Get-Template -Name "Win2019-Template"
$spec = Get-OSCustomizationSpec -Name "Windows-Standard-Spec"

New-VM -Name $vmName -Template $template -OSCustomizationSpec $spec -Datastore "Pure-Storage-01"
Start-VM -VM $vmName

Pro-tip to Avoid “Network Loss” After Deployment

A common error is the virtual machine failing to recognize the network card after customization. This is often caused by old Linux network rule files (like 70-persistent-net.rules) hard-coding the Template’s MAC address. Before converting the VM to a Template, clear this file:

rm -f /etc/udev/rules.d/70-persistent-net.rules

Note on time: Ensure that the time (NTP) on ESXi and the Domain Controller is synchronized. If there’s a drift of more than 5 minutes, the automatic Domain Join process will fail immediately with a “Clock skew” error.

Mastering Customization Specs not only frees up your time but also completely eliminates manual data entry errors. Your system will always be standardized and ready to scale out at any time.

Share: