How to Create a Template from a Virtual Machine

Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

This section describes how to create a template from an existing virtual machine.

Warning

Creating a template destroys the virtual machine that is used as the template's source because Sysprep strips the virtual machine of its computer identity. If you want to continue to use the source virtual machine after creating the template, you must clone the virtual machine before you start. For instructions, see How to Clone a Virtual Machine.

Before You Begin

To convert to a template, the virtual machine must meet the following requirements. Confirm the following before creating a template:

  • The virtual machine must be managed by Virtual Machine Manager.

  • The virtual machine must be deployed on a host.

  • The system partition must be the same as the Windows partition.

  • The Administrator password on the virtual hard disk should be blank as part of the generalization process. However, the Administrator password for the guest operating system profile does not have to be blank.

  • The supported capacities for some hardware components depend on the virtualization platform. For more information, see Supported Hardware Capabilities.

  • The virtual hard disk must have a supported operating system installed. For more information, see Supported Operating Systems for Virtual Machines.

Procedure

The following procedure describes how to create a virtual machine template from a virtual machine.

  1. In Library view, in the Actions pane, click New Template.

  2. Complete the New Template Wizard.

Wizard Page Action

Select Source

  1. Click From an existing virtual machine currently located on a host, and then click Select.

  2. In the Select Library Resource dialog box, select the virtual machine that you want to use as the source, and then click OK.

Template Identity

Enter a template name and description, and specify the owner of the template. The template owner must have an Active Directory domain account. All VMM administrators and delegated administrators who have access to the library server with the template will be able to use the template. Templates are assigned to the scope of a user role and all self-service users in that self-service user role may use the assigned templates.

Note

By default, virtual machines created from the template are owned by the user who creating them. Templates are assigned to self-service policies through the user-role properties, which does not require the owner to be the same as the user.

Configure Hardware

Customize the hardware settings as needed. The template inherits the hardware configuration of the source virtual machine. The links below open procedures for key configurations.

If virtual machines created with this template will be accessed over a network, you must configure a network adapter to connect to each virtual network.

Note

To be able to configure the template to add new virtual machines to a domain, later in this procedure, you must configure at least one network adapter.

To configure network adapter

  1. On the New toolbar, click Network Adapter.

  2. In Connected to, select the virtual network that the virtual machines will use. The list contains all virtual networks that have been configured on the host.

    Note

    To support virtual machine migration, you need to configure standard networks on all hosts. If the host does not contain a virtual network that is configured for the virtual machine, migration fails.

  3. Under Ethernet (MAC) address, specify a dynamic or static IP address.

  4. Configure the hardware components. For information about how to configure one or more components on the hardware profile, see the following topics:

    • Startup Order—Specify the BIOS boot order by specifying the startup order of devices when starting the operating system.

    • CPU Requirements—Specify the processor requirements of a virtual machine on a host.

    • Memory—Specify the amount of memory to allocate on a host for a virtual machine, and whether to use Dynamic Memory.

      Note

      Support for Dynamic Memory was introduced in Virtual Machine Manager (VMM) 2008 R2 with Service Pack 1 (SP1).

    • Floppy Drive—Configure the virtual floppy drive to read a physical floppy disk on the host or to read a virtual floppy disk file stored in the library.

    • Video Adapter—Configure the virtual video adapter for a virtual machine.

      Note

      Support for video adapter settings was introduced in VMM 2008 R2 with SP1.

    • DVD or CD Drive—Add a virtual DVD or CD drive to an IDE bus.

    • Virtual Hard Disk—Add a virtual hard disk to an IDE device or a SCSI adapter.

    • Network Adapters—Configure one or more virtual network adapters for a virtual machine.

    • Priority and Availability—Configure how CPU and memory resources are allocated and whether virtual machines are highly available.

      Note

      Support for memory resource priority was introduced in VMM 2008 R2 with SP1.

Guest Operating System

Configure identity information, administrative credentials, and user access to computers based on the template.

  • General Settings: Enter the following settings:

    • Identity Information--Specify a computer name. To randomly generate a computer name for virtual machines based on the template, enter an asterisk in the Computer name field.

    • Admin Password: Specify the local Administrator password for the virtual machine. If virtual machines created with this template will not be in a domain, users must use this password to gain access to the local computer.

      Note

      To prompt the user for a password when they create a virtual machine with the template, enter an asterisk (*) in the Admin Password field. If you leave the field blank, virtual machine creation will fail.

    • Product key: If you want the template to provide a product key for virtual machines, enter a product key in the Product key field. To require users to provide their own product key when they create a virtual machine, leave the field blank.

      To provide the product key through a Sysprep answer file, use the Answer File setting under Scripts to specify a Sysprep answer file that has the appropriate product key. Then select the Product key provided by answer file check box under Product key. When a virtual machine is created from the template, the product key will be imported from the Sysprep answer file.

      Important

      If you will provide a product key for the virtual machines created with the template, to enhance security during virtual machine creation, it is recommended that you provide the product key through an answer file instead of adding the product key directly to the template configuration.

    • Time Zone : Select the appropriate option from the Time Zone drop-down list box, or accept the default time zone.

    • Operating System: Select the operating system that will run on the virtual machine. This selection does not install an operating system.

  • Networking: Configure settings to determine network access for virtual machines:

    • Domain/Workgroup: If you want virtual machines that are created from this template to be in a domain, click Domain. Then specify a user account that will be used to add the computer to the domain at first logon. If the virtual machines that are created from this template will not be in a domain, click Workgroup, and then enter the name of the workgroup.

  • Scripts: Use the options under Scripts to provide additional settings for Sysprep:

    • Answer File: You can attach a Sysprep file (for Windows XP, Windows Server 2000, or Windows Server 2003) or an Unattend.xml file (for Windows Vista or Windows Server 2008) to the guest operating system profile. The answer file script must be stored on a library share.

      To select an answer file, click Browse to open the Select sysprep.inf script dialog box, and then select the file.

      To add settings, in the Answer file field, specify the SysPrep or Unattend file to run. The settings in the answer file will be appended to those from the wizard.

    • [GUIRunOnce] Commands: If you want to specify one or more commands to run the first time a user logs on to a virtual machine, type a command that you want to add in the Command to add field, and then click Add. This action adds the command to the [GuiRunOnce] section of the SysPrep file.

Select Library Server

Type or select the library server where you want to add the template, and then click Next. For more information, see How to Add a Library Server

Select Path

Specify the path on the available library shares to store the virtual machine template.

Summary

Review your settings. To create the template, click Create.

See Also

Concepts

How to Create a Virtual Machine from a Template