Install Windows 7 directly to a VHD or Virtual Hard Disk
Now, how would a user get about to actually performing an install of Windows 7 to a VHD?
Take note that this guide will also work with Windows
Server 2008 R2.
1. Boot from the Windows 7 DVD.
2. Click past the Language Selection screen.
3. When you’re on the Install Now screen (with the “Install
Now” button), stop. Click “SHIFT+F10″ to launch the Command
Prompt (don’t bother going through Repair and all that –
this is the right way).
4. First, let’s take a look at the drive letters currently
mounted. Type in “fsutil fsinfo drives” and hit enter. This
will list all drives (you should know what your drive
letters are). Take note of all drive letters.
5. Now,we need to open “DISKPART.” To do, simply type in
“diskpart” and click enter. Pretty easy.
6. When “DISKPART> ” appears, DISKPART is loaded.
7. If you want to just use an existing VHD, then use these
two commands (of course C can be swapped out with any drive
letter, but either way, you will need to specify the exact
path):
select vdisk file=C:\path\to\vhd\file.vhd
attach vdisk
If you are using an existing VHD, skip to the next step;
otherwise, if you would prefer to simply create a new VHD,
then use this format of commands (the max option specifies
the file size, here I have roughly 6GB, increase as
preferred):
create vdisk file = c:\path\to\vhd\file.vhd max=6000
select vdisk file = c:\path\to\vhd\file.vhd
attach vdisk
exit
8. Now run “fsutil fsinfo drives” again. A new drive letter
should have appeared, this is your new VHD. Take note of the
drive letter (this isn’t necessary – just making sure
everything went OK).
9. Type “exit” again and hit enter. This will close the
Command Prompt.
10. Click “Install Now” and go through the install as usual,
making sure to select the “Custom” option when it appears.
11. When you come to the list of partitions and you are
asked to choose an install location, ignore any warnings and
select the partition that matches the size that you used for
your VHD.
12. Windows 7 will automatically configure your boot loader
for the VHD, but this is easily fixed. Just continue as
normal, and when the installation completes and it prepares
to reboot, it will show you the bootloader (should have two
“Windows 7″ options if you already had a Windows 7 install,
this is normal). Select either OS and continue (just make
sure that it’s a Windows 7).
13. Now, if you are fine with the way the bootloader
appears, you can quit now. Otherwise, you can follow this
guide and use the bcdedit command-line tool (really easy,
only three commands) or download EasyBCD and use that to do
this yourself. However, I suggest using bcdedit and making
your bootloader a little more clear (Again, you can opt for
EasyBCD if you prefer a graphical menu). open the Command
Prompt as an Administrator (right click and select “Run As
Administrator”).
14. Type in “bcdedit /v” and hit enter. This will display a
list of entries in the Windows 7 bootloader.
15. Determine the VHD install and copy the GUID (listed as
identifier) and create a new command like the following
(replacing GUID with your identifer (should be a really long
set of numbers with hyphens – include all of it)):
Take note that you can edit the description as you wish.
This is what will appear in the bootloader.
bcdedit /set {GUID} description “Windows 7 (VHD)”
16. If you want your VHD install to appear last (or second)
in the bootloader, then execute this (again, replacing GUID):
bcdedit /displayorder {GUID} /addlast
Now, enjoy your new Windows 7 install. :)
Credit: Windows7news.com





