This tip covers how to rapidly deploy VMs using Hyper-V's management platform
But when it comes to VM replication, copying-and-pasting a VM is only half the battle. Once you've made a copy, you have a duplicate of your source VM, but it takes extra work to customize a VM for your environment. Hyper-V and its management technology SCVMM are equipped with a functionality that automates the second half of this procedure. Although at first the process may seem backward, the end result is the ability to rapidly deploy new VMs with a few clicks. Here's a step-by-step explanation of how to use Virtual Machine Manager to create and deploy virtual machines. Step 1: Creating a source VM
To begin, you need a source VM. It should be configured as you want your resulting virtual machines to appear: that is, with all the applications, configurations, updates and other utilities you require. Similar to Symantec's Ghost cloning application, the source VM is the "golden image" from which your other machines originate.
Here's the "backward" part of the VM deployment process: The protocol that Virtual Machine Manager uses to create a template from the source VM destroys the machine in the process. Prior to starting, you should clone a copy of this VM to your library and use the powered-off original as the source VM. This is because SCVMM's use of the Sysprep tool (a utility for Windows OS deployment) requires the source machine to be powered off during the process. SCVMM also doesn't support the creation of templates from Hyper-V VMs that have checkpoints, so you need to roll up or delete the checkpoints in any VM you plan to use as a template source.Step 2: Creating hardware and guest OS profiles
To create a VM template, Virtual Machine Manager requires three things: a source machine, a hardware profile and a guest OS profile. The hardware profile outlines the virtual hardware that's configured for what will become the deployed VM. The guest OS profile identifies specific information about the operating system in the template. Finally, there's the source that has already been created.
The first step in building a VM template is to create a hardware profile. In the Library view, click the New Hardware Profile link and give the profile a name. Next, click the Hardware Settings tab. It will take you to a hardware profile view similar to the one you see when creating new VMs from scratch. The difference here is that with the hardware profile, you then set the profile for every VM that you create with this template. Make your selections wisely, because things can get out of control when you're rapidly creating new virtual equipment.
Once your virtual hardware has been identified through its profile, you need to create the guest OS profile. In the Library view, click the New Guest OS Profile link and name the profile. Under the Guest OS tab, you'll see a number of options associated with the operating system, as well as specific elements that will be applied to a VM when it's deployed. Elements such as machine name, local administrator password, product key for Windows, time zone, installed OS and connected domain should be entered into the profile.
As you'll see, most of the Sysprep configuration is completed in the guest OS profile. If you're particularly good with Sysprep tool's answer files, you can even add a file in the scripts location. It's also possible to populate the GUIRunOnce key, which fires a command line executable, or script, the first time a user logs in to the machine, providing further customization. For VM deployment, the combination of these elements within the guest OS profile is where SCVMM really shines.Step 3: Creating and deploying the VM template
With all three elements in place, you're ready to create your first VM template. In the Library view, click New Template to start the process. The wizard's first screen asks you to identify the Virtual Hard Disk (VHD) source for this template. The source can be either the powered-off VM discussed previously or another template or VHD that is stored in the library. Again, it's worth noting that using an existing VM to complete this process will destroy the virtual machine, so choose wisely.
The remaining steps in the template configuration process are to assign a hardware and guest OS profile and to select the Library Server and path to store the template. Set the hardware and guest OS profile in their respective screens, or the template will have the default settings, which will likely force you to begin the process anew. Completing the wizard begins the template creation, starting by running Sysprep on the machine. If the process is done correctly, it will take some time.
Once the template has been created, the source VM no longer exists and a new template is added to the Library. Deploying the template with its associated profiles is done by right-clicking on the template and choosing the New Virtual Machine option. Viola! Your new VM is fully deployed in a rapid fashion.
|Greg Shields, MCSE, is an independent author and consultant based in Denver with many years of IT architecture and enterprise administration experience. He is an IT trainer and speaker on such IT topics as Microsoft administration, systems management and monitoring, and virtualization. His recent book Windows Server 2008: What's New/What's Changed is available from Sapien Press.|
This was first published in May 2009