How to: Building a Hyper-V host using the boot from VHD feature

A great new feature within Windows 7 and Windows 2008 is boot from VHD. Yesterday I downloaded the Windows Server 2012 Release Candidate version. The executable is self-extracting withs contains a sysprepped VHD file, cool!! I configured my Windows 7 desktop to boot from this VHD and voila, there’s my Windows Server 2012!! 🙂

1.) Download the self-extracting executable file from Microsoft Download
2.) Run the executable. There’s a new folder created expandedVHD
3.) Within this folder there’s a VHD file
4.) Open the Computer Management and select Diskmanagement
5.) Right-click on Diskmanagement and select Attach VHD
6.) Browse to the VHD file in the expandedVHD folder and select the file
7.) The VHD file is mounted now and there’s a driveletter attached. In my example D:
8.) You can browse the D:\ disk within the Windows Explorer to view the files inside the VHD
9.) Open a command prompt (with Administrative Rights) and type:
bcdboot D:\Windows
This will modify the bootrecord, so you’re able to boot from this VHD
10.) Open a command prompt in type MSCONFIG
11.) Select the second tab and view the new boot option “Windows Server 2012 Release Candidate (D:\Windows)”
12.) Reboot your machine and select Windows Server 2012 Release Candidate in the bootmenu
13.) After completing the sysprep phase, you’ve a Windows Server 2012 up and running
14.) Whitin the Server Manager Dashboard select Add roles and features
15.) Select the Hyper-V role
16.) Select the default locations for the Hyper-V files and hit Next
17.) The Hyper-V role will be installed now
18.) Reboot your system and the Hyper-V host is ready to use
19.) From the Hyper-V Manager you’re able to a create a new virtual machine. In my example a Windows Server 2008 R2 VM









How to: Using Differencing Disk and Sysprep Image to create Hyper-V guest on Windows Server 2008 R2

When you have to create an testlab environment with multiple servers, it is a big job to install all the servers. Even when you are using Hyper-V in this environment. You manually have to install all the servers or make clones of another virtual machine. In this scenario it is very usefull to make use of Differencing Disks within Hyper-V. A Differencing Disks are linked to an master VHD file. This master VHD file is a virtual machine that has been sysprepped.

Basically, all of the main reads for the VMs created with a differencing disk come from the master VHD, while any changes (writes) are written to the differencing disk. The differencing disk will remain fairly small, because the amount of change should be minimal. You’re probably looking at around a couple of GBs per differencing disk. With a differencing disk you can build multiple machines with the same parent sysprep image.

You can build this environment by following the next steps;

1.) Create a new virtual machine within Hyper-V
2.) Install the Operating System with the specific updates
3.) Optionally you can install some base applications
4.) Sysprep the virtual machine. You can use the following command:
%windir%\system32\sysprep\sysprep.exe /generalize /shutdown
5.) Now the virtual machine is sysprepped and power off
6.) Create a new virtual machine (or multiple)
7.) Create a new VHD using differencing disk
8.) Navigate to the base VHD file you’ve just created (the sysprepped virtual machine)
9.) Edit some other settings within the virtual machine (cores, memory, NIC, etc.)
10.) Boot the new virtual machine
11.) Walk through the “First Run” steps of the Operating System
12.) The new virtual machine is now ready to use
13.) Navigate to the differencing disk (VHD) and see how big it is…right it’s really small! 🙂