Friday, December 17, 2010

Deploying Virtual Machine Templates using SCVMM 2008 R2

O.K., so this isn't new information but still can be a little bit tricky if you're not used to the process of creating templates and if you don't have a full understanding of the sysprep utility and why it is needed to deploy multiple copies of the same machine.

An engineer came to me a while back and told me a story that sounded kinda familiar to me when I started using Hyper V a few years back. The engineer had a Hyper V deployment to do that involved creating 10 virtual machines all with the same Operating System but each would be used for different applications and roles. His quick solution to deployment was to build one virtual machine, make the necessary modifications to password policies, rdp connections, firewall etc., then shut down that vm and make another 9 copies of the VHD to use on the other virtual machines.

A good idea in theory but lacking one train of thought and that was that when the original VHD was created, this VHD had it's own SID unique to this installation and when he made another 9 copies of the VHD, each of these contained the exact same SID on the network. When all of the copied VHD's were brought online and added to the domain, it wasn't long before duplicate SID entries started to appear within the event logs on each of these, specifically the one that had the Domain Controller role!

What should have been done first to avoid this problem was to build the initial VHD and configure it as needed. Then he should have opened up a command line and browsed to the 'C:\Windows\System32\sysprep' folder and ran the following command:

sysprep /oobe /generalize

Once this command was completed from running on the VM, it shuts it down and the Virtual Hard Disk is now ready for deployment as an Out Of Box Experience (oobe) and Generalized machine with no SID!

All that has to be done now is to make a copy of this VHD and store it for safe keeping as it is going to be your master VHD for deployments in the future. In this engineers case, he could then make 9 copies of this newly sysprep'd VHD and when each one is run within Hyper V, the VM will start to request the relevant configuration settings such as Product Key and user settings to complete the installation.

Now, I know the title of this blog topic is 'Deploying Virtual Machine Templates using SCVMM 2008 R2' and I haven't yet even mentioned SCVVM!

The above process is quite laborious and can take a bit of getting used to along with still leaving a lot of configuration steps to finalise on each newly deployed VM. Within SCVMM however, this process is simplified greatly and takes away the need to run a command line sysprep from within the initial VM.

If you take a look at the document in the link below created by Virtualisation MVP Aidan Finn that outlines a comprehensive step by step process to creating and deploying an SCVMM 2008 R2 Template:

No comments:

Post a Comment