Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 815
  • Last Modified:

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.
0
Daera
Asked:
Daera
  • 6
  • 5
  • 2
2 Solutions
 
WotanAUCommented:
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.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Have you created a Customization which will do this for you when your Deploy the template.

Select Home --> Management --> Customization Specifications Manager --> New

This will Create the Customization Specifications template which feeds information into Sysprep, so you do not have to run it manually, and then you select this Customization Specifications at Deployment of Template.

This assumes you have vCenter Server, which I assume you have to be able to Convert a VM to Template for deployment.

If when creating the VM for Deployment, the name specified in the GUI, can be the name which is given to the VM for deployment.
0
 
DaeraAuthor Commented:
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.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
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
0
 
WotanAUCommented:
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.
0
 
DaeraAuthor Commented:
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.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
You select Deploy Template, and it then Asks you if you want to select the Customization Specification, and you select a previously saved specification.
0
 
DaeraAuthor Commented:
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.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
correct option - Deploy Virtual Machine from this Template, as you go through the Wizard, there is then a Question

Guest Customization, three options, select the third, use an existing.....

Guest Customization
this will then deploy the template, and use your Customized Specification as the Answer files, used by Sysprep in the background to Deploy the VM, per your Customized Specification
0
 
DaeraAuthor Commented:
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?
0
 
DaeraAuthor Commented:
Thanks for answers.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
No problems.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now