2

IT just setup vCenter 4.1 for my team. Using vSphere client, I:

  • Created a VM (name: A)
  • Cloned to a template
  • Deployed a VM (name: B) from the template, checked the option to name the computer name same as the VM name.
  • Once VM starts, its computer name is still "A"!!
  • I had to rename and reboot it for the name to take effect
  • This is not practical for me since I need to deploy over 20 VMs from the template

This used to work perfectly in 4.0, what am I doing wrong?

Also, can anyone please point me to a script sample I can use a baseline to create these 20 VMs in a loop from the template? and if there is no way to resolve the name issue described above, perhaps I can include the renaming code inside the script instead of doing it manually for each VM.

Mark Henderson
  • 68,823
  • 31
  • 180
  • 259
sOltan
  • 163
  • 7

2 Answers2

6

The VM Customization wizard is a bit odd in that it does a reboot of the server after deploying for its changes to take effect. The standard flow is:

  1. Deploy VM from template, using customization wizard.
  2. Power on VM.
  3. VM finishes booting, vmware tools do the customization, then they issue a reboot.
  4. When VM boots the second time, all changes are in place.
EEAA
  • 109,363
  • 18
  • 175
  • 245
  • 1
    Just to be clear you need to have vmware-tools installed in the VM template image before cloning so that it can wake up and make changes during the boot process. – mtinberg Jul 06 '11 at 21:13
  • ErikA, yea, but the new VM after it reboots still has the original VM's netBIOS name. Very strange. In the wizard's step of deploying the VM from template, instead of picking the option to name the netBIOS name as the VM, I supplied a name explicitly, still didn't take effect. I then tried again by supplying the name at the wizard deploy time, still didn't take effect. Hitting a wall. – sOltan Jul 06 '11 at 21:26
  • mtinberg, I looked at the seed VM from which I cloned the template, and saw vmware tools installed, having only one tool called "Start VM Statistics Logging". Does this provide a clue? perhaps I'm missing a particular tool? – sOltan Jul 06 '11 at 21:29
  • mtinberg, there are actually a bunch of files and a few folders installed in the path c:\program files\vmware\vmware tools\ – sOltan Jul 06 '11 at 21:40
1

To answer your second question, I would install PowerCLI and write a simple PowerShell script that calls New-VM with the proper parameters. If you don't know the VMware API or PowerShell you can probably get away with copy and paste for the handful of commands you need.

mtinberg
  • 1,833
  • 11
  • 9
  • mtinberg, thanks, i'll explore this. I don't know vmware api or PowerShell, so I hope there is useful documentation/snippets out there. – sOltan Jul 06 '11 at 21:32