VM Templates and Customisation

By provisioning a template of the most used operating systems in your virtual environment you can save time deploying new virtual machines and ensure a consistent standardisation of guests across the estate. A template takes the virtual disks and virtual machine configuration files and forms a master image, from which new virtual machines with the same configuration settings can be deployed. Furthermore a customisation specification can be applied to make OS specific customisations such as host name, domain join, product key, etc. as well as generating a new SID for each VM.

In this post we will create a virtual machine running Windows Server 2016, convert it to a template, create a customisation specification, and then deploy a new virtual machine using the template and OS customisation. A virtual machine can be converted to a template or cloned to a template to leave the virtual machine intact. A template cannot be powered on or altered but can be converted back to a virtual machine if modifications are needed at a later date. Templates and customisation specifications both require a vCenter Server instance.

template

Creating a Template

First we need to provision a new virtual machine to act as the base for our template. Select Create a new virtual machine and click Next.

vm1

Give the virtual machine a name and select a folder location, click Next.

vm2

Select the destination compute resource; host or cluster and click Next.

vm3

Select the storage to use for the virtual machine and click Next. Verify the version of ESXi in use in your environment and click Next; this sets the virtual machine hardware version, which can be upgraded at a later date but cannot be downgraded.

vm4

Select the operating system that will be used, this does not install the OS but determines the version of VMware Tools to use.

vm5

Amend the virtual hardware settings if required and click Next. On the review page click Finish, the virtual machine will now be deployed.

vm6

Once the virtual machine is provisioned install the guest operating system. To mount an ISO click the virtual machine in the vSphere inventory, on the Summary tab under VM Hardware locate CD/DVD Drive 1. Click the disconnected symbol and select to connect to the host drive, or mount a file from a shared datastore. To mount installation media from your client machine install the VMware Remote Console Application available from VMware downloads. Launch the Remote Console from the summary tab of the virtual machine.

template1

After the guest OS is installed the first thing to do is install VMware Tools. Right click the virtual machine in the vSphere inventory and select Guest OS, Install VMware Tools.

vmwaretools

Apply the necessary customisations to the operating system as required. When ready shut down the guest OS cleanly. Right click the virtual machine in the vSphere inventory and select Template, Convert to Template. Remember to remove any ISO mappings or other settings which should not be applied to virtual machines deployed from this template.

convert

Templates are only visible in the VMs and Templates view (not in Hosts and Clusters). The inventory icon also changes from the standard virtual machine to a template icon. Before deploying virtual machines from our newly created template we should setup a customisation specification, to configure OS specific aspects of the guest and create a new SID for each VM.

Customisation Specifications

On the home page of the vSphere web client navigate to Customisation Specification Manager. Click the new customisation specification icon to load the wizard. Amend the target VM operating system as appropriate and enter a name and description, click Next.

customspec

Enter the registration information for the operating system and click Next.

customspec1

Select the desired option for the host name, this sets the computer name within the operating system. Click Next.

customspec2

Enter the product key to use with the operating system and click Next.

customspec3

Set the administrator password and tick the auto logon box if required, then click Next.

customspec4

Set the time zone for the operating system to use and click Next.

customspec5

Enter any commands to run at user log on and click Next.

customspec6

Configure the network settings and click Next.

customspec7

If the virtual machine should join a domain enter these details here and click Next.

customspec8

Accept the default value to generate a new SID and click Next.

customspec9

Confirm the details on the review screen by clicking Finish. The customisation specification is now ready to use when deploying a virtual machine.

Deploy a VM

Finally we can deploy a virtual machine using the newly created template and customisation specification. Locate the template in the vSphere inventory – remember to browse using VMs and Templates. Right click the template and select New VM from This Template. Enter a name for the virtual machine and select a folder location, then click Next.

deploy1

Select the compute to use (host or cluster) and the storage for the virtual machine files. On the clone options page tick Customise the operating system and Power on virtual machine after creation, then click Next.

deploy2

Select the customisation specification to use and click Next. On the review page click Finish.

deploy3

A new virtual machine will be deployed from the template, powered on, and have the guest customisations applied that we configured earlier. It is worth noting that the customisation specification can take a few minutes to apply.

To learn how to convert a physical server to a virtual machine see the Physical to Virtual Machine Conversion Guide.

One comment

  1. […] learn how to deploy virtual machines and templates see the VM Templates and Customisation guide. To learn how to convert a physical server to a virtual machine see the Physical to Virtual […]

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: