Virtualization administrators can use templates to create multiple VMs. While there are several ways to do this in vSphere, one method that doesn't get much press is to use clones as templates in VMware Workstation.
This tutorial will explain how to install a minimal VM -- a template shouldn't have much configuration – that you'll then snapshot to put in template mode. Based on that template, you will install clones to complete the procedure.
Preparing the VM
Before entering template mode, you need to install a normal VM. Make sure it is streamlined. Remove everything that is specific to a particular system and anything you won't need in the clones you will create later.
Changing identity on a Linux VM
If you're making clones of Linux VMs, the procedure is easy. Start the cloning process, and, once completed, change a few items. Typically, on a Linux VM you need to change the following to create a new identity for the cloned VM:
- IP address
- Entry for this host in /etc/hosts
After changing these, restart the VM to make sure it picks up the new identity.
Changing identity on a Windows VM
On Windows, changing the VM identity is more complicated because the Windows license is bound to the identity of a Windows VM. To be compliant with the Windows license you've purchased, generate a new identity and enter a new license code for it.
The most versatile way to do that is to use SYSPREP, which resets Windows to its original state.
Using sysprep to create a Windows template
On Windows, the template procedure is more complicated, because the identity of a Windows machine isn't just in a few configuration files -- it's all over the Windows VM. That is why Microsoft created sysprep, a tool to create a base image of a VM, which is typically found in the c:\Windows\System32\Sysprep folder of any Windows installation.
Normally you don't want to run sysprep on a VM that has a lot of things installed. Use sysprep to create a template of a new minimal VM for easier deployment.
After installing the Windows VM that has basic configuration, start sysprep and select the "Enter System Out of Box Experience" option. This removes all personalized information from the Windows VM.
Also select "Shutdown" as the default shutdown mode -- you want the VM to be shut down after finishing with sysprep -- and select the "Generalize" option.
If you don't change the shutdown mode from "Restart," then the VM will restart and the reconfiguration will start automatically.
Select "Enable template mode" in the VM settings.
After using sysprep, open "Settings" from the VM menu, click the "Options" tab and then click "Advanced." From here, select "Settings > Enable Template mode" and click OK.
Creating a clone from a snapshot
After setting template mode, create a snapshot of the VM. Now you can clone the VM. In the clone wizard, select the option to create a clone based on a snapshot. This should be the only option because the VM is in template mode.
You can chose any other options the rest of the way; they are not important for the cloning process to complete. When you start the VM again, it will start in the same way a Windows instance starts on a new computer. You will need to enter the license information first and provide all other required details to configure the VM.