I am normally one of the first to jump aboard and start playing with a new OS. For some reason, however, I have been holding off on running Windows 7. I imagine a big part of it has to with the length of time it took me to get my Vista image right and the fear that I would forget something by reinstalling the OS (I don’t usually do upgrades). I did try the first release of Windows 7 on a VM, but the performance of the PC I used was just abysmal.

Just last weekend I decided to try something I had heard Scott Hansleman mention on show #458 on .Net Rocks. Apparently it is possible to boot off a VHD (virtual hard disk) using the Windows 7 boot loader. What Scott mentioned though is that it is possible to overlay the Windows Vista boot loader with that of Windows 7. There a few hurdles to jump before you can even begin installing, however, as this isn’t as simple as creating a VPC VHD file (which doesn’t natively work)

Note – you will not be able to place the VHD file on a disk that is encrypted by BitLocker or some other encryption sofware. So if you don’t have another partition you might want to look at running DiskPart to shrink the encrypted partition and create a new unencrypted one at least 10 GB long (although I recommend at least 30 GB).

Step 1) First, you have get a copy of the Windows 7 image by downloading it from Microsoft. The file comes in the form on an ISO image and you need a way to get the files out of it. You can either burn the image to a DVD or use a tool that allows you to mount the image onto the file system. I recommend burning the image to DVD, as you will need it later anyway.

Step 2) The next step is the most tedious. You need to locate the boot loader. There are two ways to do this. The “easiest” way is to install Windows 7 somewhere, like a VPC image, and copy the files from the installed copy. If you do this you can skip to step 4.

Step 3) If you are feeling a bit more adventurous you might try to download the Windows 7 AIK (which contains the ImageX command line tool) and the gImageX tool. These two tools will allow you to open the WIM file that holds the boot loader, boot.wim. The boot.wim file is located at \sources on the Windows 7 install disk. In order to use gImageX I recommend you create a new folder called ImageX for the exe. Then I recommend copying the following files from the \Program Files\Windows AIK\Tools\platform folder into the new folder, imagex.exe, wimgapi.dll, winmount.inf, winmount.sys, winmountinstall.exe and wimserv.exe. Once you have done that double click the gImageX.exe file and click the Mount tab. You will need to choose a folder for the mountpoint and use the boot.wim file as the source. Leave the image as “1” and click the Mount button.

Step 4) To get the Windows 7 boot loader files you will need to create a new folder and go to the root of the Windows 7 installation (or mountpoint if you are following the adventurous path). You need to copy the \Windows\Boot\PCAT\bootmgr and the \Windows\System32\bcdedit.exe files to the new folder.

Step 5) Modifying the Windows Vista boot loader while Vista is running proves to be a difficult task, so the files need to be placed in some accessible place on the Vista machine you plan to install Windows 7 on. Make note where you copied these files as it will be important later. If you have disk encryption (e.g. BitLocker) running you will need to turn it off at this point in order to make modifications to the boot loader.

Step 6) Now you need to place the Windows 7 installation DVD (I told you would need it later) into your Windows Vista PC and reboot. You may have to go into your BIOS settings to ensure your PC can boot from a CD ROM, but you should see the Windows 7 installer come up.

Step 7) Click the next button on the intro screen and then choose “Repair your computer”. Then choose “Restore your computer using a system image that you created earlier” and click Next.  Windows may or may not find an image, but either way you need to click Cancel until you see a “System Recovery Options” window. At this point you will want to choose “Command Prompt”.

Step 8) At this point you will need to locate the boot loader files you copied earlier, in step 5. You will need to copy them over the existing files on the Vista OS drive. The driver letters at this command prompt are possibly different than the ones you usually see in Windows Vista, so you may need to look for the drive that has a Windows directory in it by using the “cd” (change directory) and “dir” (directory listing) commands. You will want to copy the bootmgr file to the \Windows\Boot\PCAT\ folder and the bcdedit.exe file to the \Windows\System32\ folder.

Okay now the boot loader is in place so you just need to prep a VHD file and start the install…

Step 9) I recommend creating the vhd file in a new folder on the partition you want the file to be stored(remember it cannot be BitLocker encrypted) . You can do this by executing a “mkdir” (Make Directory) command and then navigating to that folder using “dir”.  Type the following command set into the command line:

create vdisk file=YourDriveLetter\YourPath\win7.vhd maximum=30270 type=expandable
attach disk

Step 10) Close the “System Recovery Options” window by clicking the [X] (DO NOT click the shutdown or restart buttons). Click “Install Now” and then select the newly create disk which show as a disk with unallocated space.

Step 11) After Windows 7 installs you should see a new boot menu on load that allows you to run Windows 7 (off a VHD with full hardware support) and one for Windows Vista.

Don’t forget to turn disk encryption (e.g. BitLocker) back on in your Windows Vista OS if you temporarily disabled it.

Copyright © Scott P. Rudy 2009 All Rights Reserved