After deploying a new virtual machine (VM) from a template using Guest OS Customization Specifications, the resulting VM’s DNS name includes a “-0” suffix that was not part of the intended name.
Example scenario:
The original, powered-off VM was named example-vm.
Its Guest OS hostname was also example-vm.
The VM name was later changed to example-vm-aaaa, but the hostname inside the Guest OS remained example-vm.
Within the VM Customization Specifications, select Use the virtual machine name for the Computer name field.
During the Deploy From Template workflow, ensure that Customize the operating system and Power on virtual machine after creation are both selected.
After deployment, the new VM’s Guest OS hostname became example-vm-0, and the DNS name also displayed as example-vm-0 in the vSphere Client summary.
VMware Tools were installed and running within the Guest OS.
In the vCenter Server database tables (vpx_vm and vpx_entity), a record with the same VM name (example-vm) already exists.
To preserve the uniqueness of the dns.name attribute, vCenter Server automatically appends a numeric suffix (for example, “-0”) when a duplicate DNS name is detected.
To prevent vCenter from appending the “-0” suffix:
Power on the original VM and update its Guest OS hostname to a different value (for example, change example-vm to example-vm-aaaa).
Redeploy the new VM using the same name (example-vm) from the template with your existing customization specification.
This ensures the DNS name and hostname match the intended VM name without the “-0” suffix.