Total Views

Wednesday, February 16, 2011

Create Templates in Hyper-V

Base Virtual Machine

The first thing to do is create a couple or more virtual machines where you run a normal installation of any OS you need. I made myself two different machines, one with Windows 7 and another with Windows Server 2008 R2.
I won’t go into details on how you setup a new virtual machine with Hyper-V, you just go through the wizards to create a new machine and you choose which boot device you want to use (physical DVD, ISO file, network share).
When the machine is fully installed and you’re on the desktop, make sure you patch the OS fully. You can additionally install anti virus or other software if needed. Additionally you might want to install the Integration Services, if you are using other OS than Windows 7 and Windows Server 2008.
Both of those comes with Integration Services pre-installed. Avoid everything that you don’t want to have on every new machine.
Step #1: Shut down your machine and make a backup copy of the VHD. This is useful when you in the future want to re-create the base template. Do this copy before you run sysprep.
Step #2: Boot the machine (not the copy you just made) and run sysprep. Sysprep is now included with the latest versions of Windows, you will find it under C:\WINDOWS\SYSTEM32\SYSPREP\SYSPREP.EXE.
Step #3: Configure sysprep to do an OOBE, make sure you check the Generalize button or else it will not create a new SSID. Choose Shutdown in the Shutdown Options.
sysprep_options
Step #4: Copy your VHD once again, this time you are making copies of all the new machines you want to create. My advise is to make the finished sysprep image read-only, so you won’t boot and destroy the finished base template.

Creating Virtual Machine From Base Template

Now it’s time to create new virtual machines that will use the sysprepped VHD copies we have made. I created multiple copies of the server that I will use for development and testing. One of them is for Microsoft Office SharePoint Server 2007, one for SharePoint 2010, another for Team Foundation Server 2010 and a bunch of others, even one for Ubuntu Linux.
Create a new virtual machine using the wizard as you’ve done before, only that this time you’ll choose to use an existing virtual hard disk.
new_virtual_machine
Start the newly created virtual machine and your new machine will start and ask you a few standard questions like machine name. After a few minutes, you should have a completely new machine that is distinct from the base template, it does not share the same SSID or network MAC address.
sysprep_startup_2
Set_Up_Windows

No comments:

Post a Comment