8.4. Create a Windows Template

Now that you have created a Windows virtual machine, you can save its settings into a template. This template will retain the original virtual machine's configurations, including virtual disk and network interface settings, operating systems and applications. You can use this template to rapidly create replicas of the original virtual machine. For this lab, name your template FinanWinDesk.
Before your virtual machine can be used to create a template, it has to be sealed with sysprep. This ensures that machine-specific settings are not propagated through the template.
Note that the procedure below is applicable for creating Windows 7 and Windows 2008 R2 templates. To seal a Windows XP template, see the Red Hat Enterprise Virtualization Administration Guide.

To seal a Windows virtual machine with sysprep

  1. In the Windows virtual machine to be used as a template, open a command line terminal and type regedit.
  2. The Registry Editor window displays. On the left pane, expand HKEY_LOCAL_MACHINESYSTEMSETUP.
  3. On the main window, right-click to add a new string value using NewString Value. Right-click on the string value file and select Modify. When the Edit String dialog box displays, fill in the provided text boxes:
    • Value name: UnattendFile
    • Value data: a:\sysprep.inf
  4. Launch sysprep from C:\Windows\System32\sysprep\sysprep.exe
    • Under System Cleanup Action, select Enter System Out-of-Box-Experience (OOBE).
    • Tick the Generalize check box if you need to change the computer's system identification number (SID).
    • Under Shutdown Options, select Shutdown.
    Click OK. The virtual machine will now go through the sealing process and shut down automatically.

To create a template from an existing Windows machine

  1. In the administration portal, click the Virtual Machines tab. Select the sealed Windows 7 virtual machine. Ensure that it has a status of Down and click Make Template.
  2. The New Virtual Machine Template displays. Enter information into the following fields:
    • Name: Name of the new template.
      Name your new template FinanWinDesk.
    • Description: Description of the new template.
    • Host Cluster: The Host Cluster for the virtual machines using this template.
    • Allow all users to access this template: Check this box to allow all users to access this template.
  3. Click OK. In the Templates tab, the template displays the "Image Locked" status icon while it is being created. During this time, the action buttons for the template remain disabled. Once created, the action buttons are enabled and the template is ready for use.
  4. Now that you have the template, you can further modify its properties. In this example you will set its time zone and enable it to join the Active Directory. These parameters will be passed to the sysprep answers file while creating a virtual machine using this template.
    On the Tree pane navigate to the data center where you have created the template. Double-click the template and click the sysprep tab. Fill in the Active Directory domain that you have added previously, select your time zone, and click OK.
  5. You have to activate the Windows operating system for each virtual machine created using this template. To automate the activation process, configure sysprep with the volume license key you have prepared for this track.
    Log in to the Red Hat Enterprise Virtualization Manager's server console and run:
    # engine-config -s ProductKeyWindow7x64=<enter your key here>
    # service ovirt-engine restart
    
You can now create new Windows machines using this template.