Share via


Creating Virtual Machine Templates in VMM

A virtual machine template is a library resource consisting of a guest operating system profile, a hardware profile, and one or more virtual hard disks (VHDs), which can be used to create a new virtual machine. Self-service users must use assigned templates to create their virtual machines.

Warning

Creating a template can destroy the virtual machine that is used as the template's source. This is 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" (https://go.microsoft.com/fwlink/?LinkId=102844).

This topic tells how to create a virtual machine template from an existing virtual hard disk and from a virtual machine.

Requirements for the Source Virtual Machine

To be converted to a template, the virtual machine must meet the following requirements:

  • One of the following operating systems must be installed: Windows Server 2003 or Windows Server 2003 R2.
  • 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 Sysprep process. However, the Administrator password for the guest operating system profile does not have to be blank.
  • Virtual Machine Additions must be installed on the virtual hard disk that contains the operating system. For instructions, see "How to Install Virtual Machine Additions on a Virtual Machine in VMM" (https://go.microsoft.com/fwlink/?LinkId=103799).
  • The virtual machine must be deployed on a host. This is required because the wizard runs Sysprep.exe on the running virtual machine, and Virtual Server must be present to run the virtual machine.

Creating a Template from a Virtual Hard Disk

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

Considerations

When you create a template from a virtual hard disk:

  • Sysprep strips the virtual machine of its computer identity. If you want to continue to use the source virtual machine, you must clone the virtual machine before you create the template.

Procedure

The following procedure tells how to create a virtual machine template from an existing virtual hard disk.

  1. Prepare the source virtual hard disk, which has the operating system installed, for duplication:
    1. Run Sysprep on the .vhd file to remove computer identity information from the disk.
    2. Install Virtual Machine Additions on the .vhd file. For more information, see "How to Install Virtual Machine Additions on a Virtual Machine" (https://go.microsoft.com/fwlink/?LinkId=103799)
  2. Add the source .vhd file to the library. For more information, see the "How to Add Files to the Library" Help topic (https://go.microsoft.com/fwlink/?LinkId=98990)
  3. In Library view, in the Actions pane, click New Template.
  4. Complete the New Template Wizard.
Wizard Page Action

Select Source

  1. Click Use an existing template or virtual hard disk stored in the library, and then click Select.
  2. In the Select Library Resource dialog box, select the virtual machine that you want to use, 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 AD DS domain account. All VMM administrators will be able to use the template.

Note

If you were to use the template in virtual machine self-service, you would need to specify an owner. Only the template owner -- whether an individual self-service user or a group assigned to the self-service policy -- would be able to create, see, and manage virtual machines created with the template.

Configure Hardware

Customize the hardware settings as needed. 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. For more information, see "How to Configure Virtual Networks on a Host" (https://go.microsoft.com/fwlink/?LinkId=98838).

  3. Under Ethernet (MAC) address, specify a dynamic or static IP address.
    More about configuring network adapters

To configure additional hardware for the virtual machine, use the following procedures:

  • CPU Requirements -- Specify the amount of memory on a host that you want to allocate to any virtual machine created from the settings on this hardware profile.
  • Amount of Memory -- Specify the processor resources on a host that you want a virtual machine to use.
  • Floppy Drive -- Specify the virtual floppy drive settings. The virtual floppy drive can read a physical floppy disk inserted into the physical floppy drive on the host or it can read a virtual floppy disk file stored in the library.
  • DVD Drive or Virtual Hard Disk (IDE) -- Specify which IDE devices that you want to add and configure on a virtual machine.
  • Virtual Hard Disk (SCSI adapter) -- Specify one or more virtual SCSI adapters to a virtual machine. You can then attach a virtual hard disk to the SCSI adapter.
  • Network Adapters -- Configure one or more virtual network adapters to connect to virtual networks.
  • Virtual Machine Priority for Host CPU Resources -- Specify how CPU resources are allocated among virtual machines deployed on the same host.

Guest Operating System

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

  • Identity information: Enter the following settings:
    • Computer name--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.
    • Full name, Organization name -- The Full name and Organization name fields provide required information for customization of the virtual machine during the Sysprep process. You can optionally provide the information through the template.
    • 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.
  • 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 for a password when the user creates 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.

  • Networking: Configure settings to determine network access for virtual machines:
    • 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. (This option is only available if you configured at least one virtual network on the Configure Hardware page.)
    • 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:
    • To add settings to those that the wizard will pass to SysPrep, in the Answer file field, specify the SysPrep.inf file to run. The settings in the .inf file will be appended to those that the wizard passes.
    • To automate mini-Setup, in the [GUIRunOnce] Commands field, enter the commands to run at first logon.

Summary

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

Creating a Template from a Virtual Machine

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

Considerations

To be converted to a template, the virtual machine must meet the following requirements:

  • The virtual machine must be managed by Virtual Machine Manager.
  • The virtual machine must have one of the following operating systems: Windows 2000 Server, Windows Server 2003, or Windows Server 2003 R2
  • Virtual Machine Additions must be installed on the virtual hard disk that contains the operating system. For more information, see "How to Install Virtual Machine Additions on a Virtual Machine" (https://go.microsoft.com/fwlink/?LinkId=103799)
  • The virtual machine must be deployed on a virtual machine host. This is required because the wizard runs Sysprep.exe on the running virtual machine, and Virtual Server must be present to run the virtual machine.

Procedure

The following procedure tells how to create a virtual machine template from an existing virtual hard disk and 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, and then click OK.
  3. In VHD containing OS, select the virtual hard disk that contains the system files.

Template Identity

Enter a template name and description, and specify the owner of the template. The template owner must have an AD DS domain account. All VMM administrators will be able to use the template.

Note

If you were to use the template in virtual machine self-service, you would need to specify an owner. Only the template owner -- whether an individual self-service user or a group assigned to the self-service policy -- would be able to create, see, and manage virtual machines created with the template.

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. For more information, see "How to Configure Virtual Networks on a Host" (https://go.microsoft.com/fwlink/?LinkId=98838).

  3. Under Ethernet (MAC) address, specify a dynamic or static IP address.
    More about configuring network adapters

To configure additional hardware for the virtual machine, use the following procedures:

  • CPU Requirements -- Specify the amount of memory on a host that you want to allocate to any virtual machine created from the settings on this hardware profile.
  • Amount of Memory -- Specify the processor resources on a host that you want a virtual machine to use.
  • Floppy Drive -- Specify the virtual floppy drive settings. The virtual floppy drive can read a physical floppy disk inserted into the physical floppy drive on the host or it can read a virtual floppy disk file stored in the library.
  • DVD Drive or Virtual Hard Disk (IDE) -- Specify which IDE devices that you want to add and configure on a virtual machine.
  • DVD Drive or Virtual Hard Disk (SCSI adapter) -- Specify one or more virtual SCSI adapters to a virtual machine. You can then attach a DVD drive or a virtual hard disk to the SCSI adapter.
  • Network Adapters -- Configure one or more virtual network adapters to connect to an internal or external network.
  • Virtual Machine Priority for Host CPU Resources -- Specify how CPU resources are allocated among virtual machines deployed on the same host..

Guest Operating System

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

  • Identity information: Enter the following settings:
    • Computer name--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.
    • Full name, Organization name--If only VMM administrators will use the template, the full name and organization name are optional. However, if the template will be used in virtual machine self-service, you must enter these settings to enable self-service users to successfully create virtual machines from the template.
    • 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.
  • 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 for a password when the user creates 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.

  • Networking: Configure settings to determine network access for virtual machines:
    • 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. (This option is available only if you configured at least one virtual network on the Configure Hardware page.)

      Important

      For increased security during the automation of mini-Setup, enter a user account with limited privileges.

    • 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:
    • To add settings to those that the wizard will pass to SysPrep, in the Answer file field, specify the SysPrep.inf file to run. The settings in the .inf file will be appended to those that the wizard passes.

To automate mini-Setup, in the [GUIRunOnce] Commands field, enter the commands to run at first logon.

Summary

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

Tutorial: Getting Started Creating Virtual Machines in VMM