Annotated for Newbies! [Comments in RED are mine.] Items in BOLD ITALICS are emphasis I added. My comments are not corrections to the document, but instead should help you understand better how to create Templates.

Creating Virtual Machines from a Template

Updated: November 5, 2009

Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2 http://technet.microsoft.com/en-us/library/cc764306.aspx

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. [Make these.]

 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. [Newbies should not make these.]

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: [These are the three items required. Remember them.]

 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 (http://go.microsoft.com/fwlink/? LinkID=163333). [Hardware profiles allow you to set CPU, RAM, Networks and so on. A few example profiles you might create: one for machines that need a lot of hardware, one for machines that need little.]

 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. [This simply means that you already ran Sysprep manually on a VM yourself, then saved the VHD file to the Library.] 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 (http://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 (http://go.microsoft.com/fwlink/? LinkID=163332). [Simply explained… Fill out these items correctly and you are saved the trouble of creating a customization file for Sysprep. The Guest profile feeds information to the new VM when it is first deployed so you don't have to enter any information manually. Everything becomes automatic!]

Creating a Template The following table describes the different ways of creating templates.

Template Type Description Templates created from an existing To create a virtual machine template from an existing virtual hard disk, virtual hard disk prepare the source virtual hard disk, which has the operating system [This is the hard way. You run installed, by removing computer identity information. With Windows Sysprep with no customizations operating systems, for example, you can prepare the virtual hard disk then save the VHD to the Library. with the Sysprep tool. Add the source virtual hard disk file to the Library Use the third method below and complete the New Template Wizard. For more information see How to instead.] Create a Template from a Virtual Hard Disk (http://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 When you create a template from an existing virtual machine, consider deployed virtual machine the following: [This is the method of choice. Create a VM the way you like it,  The virtual machine that you use as a source to create a then shut it down. Tell SCVMM to template must be a virtual machine that is deployed on a host (not turn this VM into a Template so you stored in the library). can deploy copies of this VM.]

[NOTE:  The source virtual machine becomes the new template and is Make a copy of the great VM before you have SCVMM turn it into a therefore no longer available as a virtual machine after the Template. Why? Just in case you New Template Wizard completes. want to make a change to it or otherwise and make another template. Making a copy of a VM is  If the source virtual machine contains checkpoints, you must: called CLONING. Right click the VM, Select 'Clone' and make a copy running on a Host, not stored in 1. Delete all checkpoints from the virtual machine in the the Library.] VMM Administrator Console

2. Stop or do a Save State on the virtual machine

3. Open the Hyper-V Manager on the host and check the status of the merge operation for the virtual machine

4. After the merge process is complete, create the template within the VMM Administrator Console

Caution

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 (http://go.microsoft.com/fwlink/?LinkID=162950). Templates created for use by self- When you create a self-service user role (to enable a user or group of service users users to create or manage their own virtual machines), you can optionally [We will ignore this part of the specify one or more templates to enable users to perform the following article as we are not interested in tasks: this right now.]  All self-service users can modify the computer name on the guest operating system profile on a template.

 Users to whom you grant appropriate privileges can also modify the Administrator password and Product Key number on the guest operating system profile on a template.

Note

Self-service users cannot modify any settings on the hardware profile on a template. For more information about self-service user roles, see About Virtual Machine Self-Service and Role-Based Security in VMM (http://go.microsoft.com/fwlink/?LinkId=119337). Non-customized templates Non-customized templates do not have an operating system profile [Do this on your own. I do not attached and can be used for operating systems that you cannot sysprep. recommend this method.] 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 [How to use the great Template you just created] 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. [These are the settings you entered in the OS Profile to automate VM deployment entirely.]

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. [Sysprep during the Template creation process does this for you.]

 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. [If you created a Template from a VM as recommended earlier you can ignore this section.]

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 (http://go.microsoft.com/fwlink/? LinkId=163808).