Hyper-V: Making Template Virtual Machines

Hyper-V_Manager Using Windows 7 and Windows Virtual PC has it's benefits. It's useful for managing a few virtual machines and you get decent graphical quality on the virtualized machines (Windows Aero Desktop). The biggest issues with Windows Virtual PC, is the fact that it cannot virtualize 64-bit OS. That means if you need to test Windows Server 2008 R2, you can't virtualize it with Microsoft's products but have to turn to third parties. If your need for virtualization is a bit more demanding, you can step it up with Hyper-V, which of course supports 64-bit virtualized OS. Hyper-V is only available with Windows Server 2008 and upwards.

Let me tell you how I have configured and setup my own virtual machine templates using the latest Windows Server 2008 R2 with 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

Final Notes

I was amazed how simple and easy it has become to make your own template machines, with both Integration Services and SYSPREP now pre-installed with the OS (Windows 7 and Windows Server 2008 R2). This makes the management, testing and development with various instances of the OS much easier than it ever has been.


Comments

Comments are closed

Pages

Search

Tags

None

    Recent posts

    Recent comments

    Blogroll

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.