VMM 2012 Technical Documentation, including Step-by Step Guides
VMM 2012 Official Cmdlet Reference
VMM 2012 TechNet Launchpad
VMM 2012 PowerShell Cheat Sheet
VMM 2008 PowerShell Cheat Sheet
2008 R2 Guides and Reference Downloads!
VMM 2008 Interactive Decision Flow
Jonathan's Virtual Blog
Virtual Machine Manager - Orchestrator - Solutions and Guidance
Templates save time! Templates make multiple custom deployments easy! Learn to use Templates!
So, essentially I have marked up two great TechNet articles on creating virtual machines from templates. This sounds a bit backwards, but these articles provide all the information needed to Create A Template. I have pointed out important points and added comments where a newbie may easily go astray. Consider this a ‘Best Practices’ for simply creating a usable template. As you learn to master this process you may find yourself branching out into greater and greater customizations. Note that there are TWO DOCUMENTS BELOW.
Having trouble reading the documents below? Links available for direct download: Doc1 Doc2
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
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:
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.]
Creating a Template
The following table describes the different ways of creating templates.
Templates created from an existing virtual hard disk
[This is the hard way. You run Sysprep with no customizations then save the VHD to the Library. Use the third method below instead.]
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 (http://go.microsoft.com/fwlink/?LinkID=162949).
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.
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
[This is the method of choice. Create a VM the way you like it, then shut it down. Tell SCVMM to turn this VM into a Template so you can deploy copies of this VM.]
Make a copy of the great VM before you have SCVMM turn it into a Template. Why? Just in case you want to make a change to it or otherwise and make another template. Making a copy of a VM is called CLONING. Right click the VM, Select 'Clone' and make a copy running on a Host, not stored in the Library.]
When you create a template from an existing virtual machine, consider the following:
· The virtual machine that you use as a source to create a template must be a virtual machine that is deployed on a host (not stored in the library).
· The source virtual machine becomes the new template and is therefore no longer available as a virtual machine after the New Template Wizard completes.
· If the source virtual machine contains checkpoints, you must:
1. Delete all checkpoints from the virtual machine in the 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
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-service users
[We will ignore this part of the article as we are not interested in this right now.]
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:
· 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.
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).
[Do this on your own. I do not recommend this method.]
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 [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.
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).
How to Create a Virtual Machine from a Template
Updated: August 14, 2009
This topic describes how to create a virtual machine from a virtual machine template.
Optionally, you can use a non-customized template without an operating system profile.
To create a virtual machine from a template:
1. In the Virtual Machine Manager Administrator Console, in Virtual Machines view, click New virtual machine.
2. Complete the New Virtual Machine Wizard.
Virtual Machine Identity
Configure the following options:
· Virtual machine name (required). Type a unique name for the virtual machine.
· Owner (required). The owner must have a domain account in Active Directory.
· Description (optional). Type a description for the new virtual machine.
To configure additional hardware for the virtual machine, use the following procedures:
· Startup Order —Select the order of devices to start the operating system.
· CPU Requirements —Specify processor requirements for the virtual machine.
· Memory —Specify the amount of memory to allocate to the virtual machine
· 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.
· 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 the virtual machine's priority for CPU resources on the host. Configure the virtual machine to be highly available.
Guest Operating System
(for customizable templates only)
[Set the 'Operating System' first. Everything else will work a bit better this way.]
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 generate a computer name randomly 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.
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 fails. [Don't want to be prompted for a password? Want the Template to be deployed successfully? Fill in a password here! Do not leave blank or use an '*' asterisk.]
· 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. [Windows Vista/Windows 2008 and up: Use this link to enter a Sysprep product key to allow the full deployment to be automated. Once the new VM is up and running you can enter your correct KMS or MAK key.
Configuring KMS Clients
· Time Zone: Select the appropriate option from the Time Zone list, 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. [Set this first! Trust me!]
· 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 log on. 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. [New to Templates? Having difficulty? Choose Workgroup! See if this works. Joining a domain can sometimes be a tricky process. Make sure everything else is working first.]
· Scripts: Use the options under Scripts to provide additional settings for Sysprep: [If you are a Sysprep veteran and know all there is to know about Sysprep please read this section. Otherwise, skip this! Make no changes in the Template.]
· 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.
To enable environment variable expansion when you create a new virtual machine from a template, you must precede GuiRunOnce commands with cmd.exe /c.
When creating a virtual machine from a template, you must choose the Place the virtual machine on a host option.
Review the rating for each host to determine the most suitable host on which to deploy this virtual machine.
If many hosts are listed, you can use the Host group, Look for, or Group by fields to display a smaller set of potential hosts.
All hosts that are available for placement are given a rating of 0-5 stars based on their suitability to host the virtual machine. The host ratings are based on the virtual machine's hardware and resource requirements and expected resource usage. They are also based on placement settings that you can customize for VMM or for individual virtual machine deployments. The ratings are recommendations. You can select any host that has the required disk space and memory available. For more information about how VMM rates hosts, see How Virtual Machine Manager Rates Hosts.
In VMM 2008 R2, for hosts that are running Windows Server 2008 R2 or for ESX Server hosts, the ratings that first appear on the Select Host wizard page are based on a preliminary evaluation by VMM. To see the host rating based on a more thorough evaluation, you must select the host by clicking it.
1. To see the placement settings that VMM used to rate the hosts, and optionally to change those settings, click Customize Ratings.
2. To view additional information about a host rating, select the host in the list, and then use the tabs in this section to view the following information:
· Details -- This tab displays the status of the host and lists the virtual machines that are currently deployed on it.
· Ratings Explanation -- If a host receives a zero rating, this tab lists the conditions that caused the rating.
· SAN Explanation -- If a SAN transfer cannot be used to move the virtual machine's files to the host, this tab lists the conditions that prevent a SAN transfer.
If a host has network optimization enabled, a green arrow appears in the Network Optimization column. VMM 2008 R2 lets you take advantage of network optimization capabilities that are available on Hyper-V hosts that are running Windows Server 2008 R2. For information about network optimization and the hardware that supports it, see the Windows Server 2008 R2 documentation. After a virtual machine is deployed, this feature is displayed only for virtual machines that are deployed on a host that is running Windows Server 2008 R2. If no host in the list has sufficient disk space to host the new virtual machine, click Previous to return to the Volume Configuration page and either remove or reduce the size of one or more volumes. You can also override the default placement options that VMM uses to calculate the host ratings. Any changes that you make apply only for this virtual machine deployment. For more information about how VMM rates hosts, see How Virtual Machine Manager Rates Hosts.
Accept the default virtual machine path on the host to store the files associated with this virtual machine. You can also click the down arrow to select a different path, or click Browse to specify a different path on the host. You can also choose the following options:
· If you selected a path other than an existing default path and want to store other virtual machines on that path, select the Add this path to the list of host default paths check box. For information about how to configure default virtual machine paths, see How to Set Placement Options for a Host.
· If you chose Store the virtual machine in the library, specify the library server that will store the virtual machine, and then select a path on the available library shares to store the virtual machine's files.
The wizard will continue with the Summary page.
Attach the physical network adapters to either Not Connected or to any of the virtual networks on the selected host.
On the Additional Properties page, accept the default settings, or modify these settings as described in How to Configure Automatic Start and Stop Actions for a Virtual Machine
Review the configuration settings. To change settings, click Previous.
Optionally, click View Script to view (and copy) the Windows PowerShell script that runs this wizard and performs the conversion. All administrative tasks in VMM can be scripted or performed at the command line. For more information, see Windows PowerShell Scripting in Virtual Machine Manager 2008 (http://go.microsoft.com/fwlink/?LinkId=110911).
Optionally, select the Start the virtual machine after deploying it on the host check box.
In Jobs view, monitor the progress of job as the new virtual machine is created and confirm that the virtual machine is created successfully. If the job fails, review the error message at the bottom of the Jobs pane for information about the cause of the failure and the recommended action to resolve the issue.
Creating New Virtual Machines
A common problem during data transfers, especially toward the end of P2V jobs, is Error 2912, with some variation of 0x8007xxxx. This is generally certificate related. I’ve put together a complete set of steps that will correct certificate issues between the SCVMM Server and Hosts. Why do certificates matter? BITS uses them… and BITS is what transfers data.
Something to keep in mind regarding P2V jobs specifically. Check Tasks that are running under the current P2V Job and you will see something similar to that below. Notice that ‘Deploy file (using LAN)’ appears to have succeeded. BITS is then no longer needed, right? Not exactly. At this point the newly created VHD of the C: drive for the system you just converted is mounted on the Destination Host. BITS is now used again as the SYSTEM registry hive is pulled from this mounted VHD, and copied to the SCVMM Server for fix up (setting things to properly boot in a virtual environment). In this case the certificates between the SCVMM Server and the Destination Host are not good.
Use the directions in the article below to correct all certificates, then start a new P2V job. It should work.
When using System Center Virtual Machine Manager (SCVMM) to perform a Physical to Virtual (P2V) conversion, the job fails at 60% with the following error: Error (2912) An internal error has occurred trying to contact an agent on the vmmserver.contoso.com server. Recommended Action Ensure the agent is installed and running. Ensure the WS-Management service is installed and running, then restart the agent.
During the 'Make operating system virtualizable' step, files are copied from the destination host (the server that will host the virtualized system) to the SCVMM Server. This BITS operation fails due to a certificate problem as indicated by the error 0x80072F0C (ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED).
To resolve this issue, remove the managed host from the SCVMM server and also delete any residual certificates from the host on the VMM server, then re-add the host:
On the SCVMM server, remove the managed host from the console. The steps on how to remove a managed host are outlined in the following TechNet article: http://technet.microsoft.com/en-us/library/cc956121.aspx (http://technet.microsoft.com/en-us/library/cc956121.aspx)
Now we need to locate and delete any certificates for the Host computer.
Open the Certificate console on the SCVMM server. a. Open a new mmc and add the certificates snap-in. b. Select the option of 'computer account' and 'local computer'. c. Select Finish and Ok to load the snap-in.
The certificates for the Host computer can be in any of the following locations. a. Personal Certificates. b. Trusted People (if the host is W2K8 or W2K8 R2). c. Trusted Root Authorities (If the host is W2K3).
In each store, expand the Friendly Name field and locate the certificate[s] for the Host server that have a Friendly Name starting with 'SCVMM_CERTIFICATE_KEY_CONTAINER' followed by either the FQDN / IP address / NetBIOS name of the Host server and delete them.
Re-add the host in SCVMM which recreates the certificates as needed.
SCVMM uses BITS to transfer payload between SCVMM managed computers. These data transfers are encrypted by using a self-signed certificate generated at the time a host machine is added to SCVMM. If these certificates are missing or corrupted from the SCVMM server or managed computers, the payload deployment job can fail. Deleting the certificates and re-adding the host will cause the certificates to be regenerated.