Link to home
Start Free TrialLog in
Avatar of Daera
DaeraFlag for New Zealand

asked on

Creating Templates from a customized VM in ESX 5.0 that generates random unique host names

Hi EE,

I have created a template of a windows server on ESX host. In brief I followed the process where I customized a VM and convert it to be a template.

I'm trying to achieve this result but having no luck.

I want VMs created from the template to have unique name after creation. This will help if I have to deploy lots of VM's from the template in a short space of time without worrying about changing the hostnames.

Any help much appreciated. Thanks.
Avatar of WotanAU
WotanAU
Flag of Australia image

If you sysprep the image before you turn it into a template (Out of Box Experience mode), you can inject an Unattend.xml file into it which will rename it on startup.

c:\windows\system32\sysprep\sysprep.exe /oobe /shutdown \unattend:unattend.xml

There is an example on This page which shows you how your unattend.xml file should look. The example here is for vista, but it should work just as well for Server 2008. This particular example will also add it to the domain for you, should you wish to do that. You can use the Windows 7 AIK which has the "Windows System Image Manager" tool, which allows you to edit the unattend file in a GUI fashion.
ASKER CERTIFIED SOLUTION
Avatar of Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Andrew Hancock (VMware vExpert PRO / EE Fellow/British Beekeeper)
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daera

ASKER

Ok just to get this right. In vcenter, I will sysprep the server.

I'm not interested in joining this to the domain or doing anything to it. It is pretty much a clean install from an ISO.

As long as it has a random name and standard things like correct time-zones, us keyboard,  etc then that will be great. Also the server is actually server 2012. Is there another unattend.xml file that can do that for me?

Thanks.
You do not Sysprep the Server, (it's done in the background by using a Customization Specification).

You DO NOT have to physically run Sysprep yourself!

 Customization Specification creates the unattended xml file for you in the background, and sets Time Zone, License Info etc

just try it, and you will see what I mean.

Start the  Customization Specification Wizard
You have to run the sysprep from within the template. Convert the template back to a VM, then boot it. Run the Sysprep command with the customised Unattend. Once the server is off, convert it back to a template.

Timezone, language, keyboard etc can all be customised in the unattend file.

This page has some good info on how to customise your Unattend to work with Server 2012. Looks almost identical, so should be nice and easy.
Avatar of Daera

ASKER

Ok hanccocka, I have done the customisation wizard and created the file. It is very easy to create. Now I need to somehow tie this to the template so that the two should work together to produce the outcome I want. This is where I need more directions. Thanks.
You select Deploy Template, and it then Asks you if you want to select the Customization Specification, and you select a previously saved specification.
Avatar of Daera

ASKER

ok the only deploy I see is "Deploy Virtual Machine from this Template" when right clicking the template and the other is "Deploy OVF Template" from the File menu.

The first one creates a VM. I haven't tried the second one. Is that the one you are refering to.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daera

ASKER

Thanks, I went through the wizard and selected the customized template I set up earlier. It went through all my settings which is fine. Is there a way of making this to just go through the already saved settings without me having to click next to the options I have saved in the xml file?
Avatar of Daera

ASKER

Thanks for answers.