VMware Cloud Community
Race667
Contributor
Contributor

DNS Name Suffix -0

I want to replace a Windows virtual machine by cloning from another and want to set the Windows Computer Name by using a Customization Spec (Computername = Use virtual machine name). The old/previous virtual Machine is still present but VMName/vSpherename is renamed (not Computername) and powered off.

Cloning finished successfully but the Windows Computername/DNS Name has the Suffix "-0". IMO vSphere recognizes that another VM has the same DNS/HOstname Name and append that suffix.

Could this check be disabled?

0 Kudos
3 Replies
TheBobkin
Champion
Champion

Hello Race667,

Whether the original VM (and all its files) are properly renamed depends on how it was done - did you just change the name on the VM Object registered in inventory via vSphere Client/Web Client? OR did you go through the steps to manually or semi-manually (rename + Storage vMotion) change these?:

https://kb.vmware.com/s/article/1029513

Bob

0 Kudos
judsonm
Contributor
Contributor

I too am running into this issue.... with -0 being appened to dns host name with the same intent....old VM object was renamed IE....new one was deployed with the original name and ip

-Server1 VM renamed Server1-old

-New VM "Server1" deployed via Template and customization but it shows DNS name of Server1-0.

-When ready for migration Server1-old is powered off then Server1 is powered on but Server1's DNS name is shown and customized as Server1-0 which is not the deployed name.

Note: data store files are irellevant for this.....but Server1-old will have Files in Server1 folder in datastore with Server1.vmdk etc

Server1 will have files Server1_1 folder in datastore with Server1.vmdk etc.

0 Kudos
judsonm
Contributor
Contributor

FYI.... I resolved this in my script with this line change by replacing the customization script to use a fixed name instead of the "vm" name

Get-OSCustomizationSpec $CustomizationScript | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress $srvip -SubnetMask $mask -DefaultGateway $GW -Dns $dns1,$dns2

With this line...

#New customization method to set static name when pre-deploying VM's with DNS Host names that already exist so servers don't end up with -0 appended to the name like "Server1-0"
Get-OSCustomizationSpec $CustomizationScript | Set-OSCustomizationSpec -NamingScheme fixed -NamingPrefix $VMName | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress $srvip -SubnetMask $mask -DefaultGateway $GW -Dns $dns1,$dns2

0 Kudos