Creating Virtual Machines from a Template
Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1
A virtual machine template is a library resource that consists of a hardware profile, a virtual hard disk, and an optional guest operating system profile. Templates provide a standardized group of hardware and software settings that you can use to create multiple new virtual machines configured with those settings. VMM supports:
Customized templates. The most common VMM templates that require an operating system profile to automate deployment.
Non-customized templates. Non-customized templates do not have an operating system profile attached and can be used for operating systems that you cannot customize, such as Windows 7 or Linux.
Note
VMM 2008 R2 supports customization of Windows Server 2008 operating systems on virtual machines that are deployed on ESX Server hosts managed by VirtualCenter 2.5 Update 4.
A virtual machine template consists of the following parts:
Hardware profile. To define a standard set of hardware settings, you can create a hardware profile and associate it with a template. When you create a new template or create a virtual machine from a template, you can specify the virtual hardware settings or reuse an existing hardware profile from the library. Like operating system profiles, hardware profiles are logical entities that are stored in the database. For more information, see Working with Hardware Profiles (https://go.microsoft.com/fwlink/?LinkID=163333).
Virtual hard disk. You can use a generalized virtual hard disk from the library or create a virtual hard disk from an existing virtual machine. If the source virtual machine for your template has multiple virtual hard disks, select the disk that contains the operating system. To simplify the generalization process, include Virtualization Guest Services (such as Virtual Machine Additions or Integration Components) in your template. For more information, see How to Create a Template from a Virtual Hard Disk (https://go.microsoft.com/fwlink/?LinkID=162949)
Guest operating system profile (optional). To use the same product key, administrator password, time zone, and other items in a set of templates, you can create a guest operating system profile and store it in the library. When you create a new template or a virtual machine from a template, you can specify the settings manually or use an operating system profile associated with your answer files. For more information, see Working with Guest Operating Systems (https://go.microsoft.com/fwlink/?LinkID=163332).
Creating a Template
The following table describes the different ways of creating templates.
Template Type | Description |
---|---|
Templates created from an existing virtual hard disk |
To create a virtual machine template from an existing virtual hard disk, prepare the source virtual hard disk, which has the operating system installed, by removing computer identity information. With Windows operating systems, for example, you can prepare the virtual hard disk with the Sysprep tool. Add the source virtual hard disk file to the Library and complete the New Template Wizard. For more information see How to Create a Template from a Virtual Hard Disk (https://go.microsoft.com/fwlink/?LinkID=162949). Note You can also create a template from an existing VHD that is not sysprepped by using a non-customized template. |
Templates imported from VMware |
After you add a VMware VirtualCenter server to VMM, use the Import templates action in Administration view to import your VMware templates to the Virtual Machine Manager library so that you can use the templates in VMM. For more information, see How to Import VMware Templates. Note To successfully import a VMware template, the VMM library server must be able to resolve the ESX Server. |
Templates created from an existing deployed virtual machine |
When you create a template from an existing virtual machine, consider the following:
Warning You cannot avoid destroying the virtual machine if you use the virtual machine to create a template. However, before you run the New Template Wizard, you can first create an identical copy of the source virtual machine by using the Clone virtual machine action in the Administrator Console in the Actions pane in Virtual Machines view. For more information, see How to Create a Template from a Virtual Machine (https://go.microsoft.com/fwlink/?LinkID=162950). |
Templates created for use by self-service users |
When you create a self-service user role (to enable a user or group of users to create or manage their own virtual machines), you can optionally specify one or more templates to enable users to perform the following tasks:
For more information about self-service user roles, see About Virtual Machine Self-Service and Role-Based Security in VMM (https://go.microsoft.com/fwlink/?LinkId=119337). |
Non-customized templates |
Non-customized templates do not have an operating system profile attached and can be used for operating systems that you cannot sysprep. For example, you can create a virtual machine for Linux from a template, but the customization must be done by the user. When creating a template from VHD or from an existing virtual machine, in the guest Operating System Profile selection page, choose Customization Not Required. |
Creating a Virtual Machine from a Template
When you start the New Virtual Machine Wizard and select a template from the library, the virtual machine settings will be set to those specified in the template. You can override the settings if you choose. With a customized template, VMM will build the virtual machine per your virtual hardware profile and apply the sysprep settings.
If you want to want to use scripting to build several virtual machines from a template and place them in the library, start by creating a maintenance host group with one or more hosts. Have your script scope placement to that host group and once customization completes, you can script the saving of the resulting virtual machine into your library.
Requirements
The virtual hard disk must have a supported operating system installed. For more information, see Supported Operating Systems for Virtual Machines.
The Administrator password on the virtual hard disk should be blank as part of the Sysprep process.
For customized templates, the operating system on the virtual hard disk must have been prepared by removing computer identity information. With Windows operating systems, for example, you can prepare the virtual hard disk with the Sysprep tool.
Note
If you create a new virtual machine from a template, you cannot store the virtual machine in the library but must place it on a host. That is because the customization step cannot be completed offline.
For more information, see How to Create a Virtual Machine from a Template (https://go.microsoft.com/fwlink/?LinkId=163808).