Many people have asked me recently how to install trials of Windows Server 2012 or Windows 8 on their current desktop or laptop.  This article applies if the laptop/desktop is running Windows 7 Enterprise, Ultimate, or Windows 8.  I will cover Windows XP in a separate post later.  There is also one restriction that this article cannot provide a solution for, and that is if you have Bitlocker enabled on the machine.  Since Windows 7 and above allow for booting a machine from a virtual hard disk, we will be utilizing this method during this blog post.  A virtual hard disk is simply a flat file that appears as a real hard disk in Windows.  The new Windows installer will automatically create a new entry in the boot selection wizard so that when the machine is booting up you will have a choice of going back into the original OS or the new one.  The first thing you should check when attempting this is the amount of free space in each of the partitions, taking note of each.  This is quite important to have written down for use during the latter steps.  Open up Disk Management by going to the Start Menu and typing in 'Disk Management' then hit ‘Enter’.  You should see a screen like this:

Disk Management in win7

Take note of the Disk number and Partition size.  Also write down the amount of Free Space.  Next insert the installation disk(Server 2012 can be downloaded here) for the new operating system and reboot the machine.  You may need to select the BIOS Options during this first boot and insure the boot order has the CD/DVD drive listed as the first boot device.  An alternate method is to hit the ‘F12’ key during the BIOS screen in order to be presented with a boot device selection menu.   Once the installation disk is started take the defaults until you reach this screen:

OS Selection

For sake of simplicity, choose the bottom option to install the Server OS with a GUI and click Next. For Windows 8 just continue on to the next step.  This next step is very important.  Click on ‘Custom Install Windows only (advanced)’.  Do NOT take the top option. 

Installation Type

Now we find ourselves at the disk selection screen.  You will not see an available disk listed here.  Hold down the ‘Shift’ key and hit 'F10’.

Disk Selector without VHD Created

You should now have a command prompt window.  Type in ‘diskpart’ and hit the ‘Enter’ key.  Type in ‘list disk’ and hit ‘Enter’.  You will see all of the physical disks listed.  Select the disk number that coincides with the drive that will be holding the new virtual hard disk by entering in this command ‘select Disk X’ where X is the appropriate number.  Next type in ‘list vol’ and hit ‘Enter’You will most likely notice that the drive letter for the proper volume based on the disk size is not what you expected it to be.  Do not be alarmed this is normal in the DiskPart utility.  Once you have noted the new drive letter proceed.

Run Diskpart

We will be using the create vdisk command.  The usage goes like this create vdisk file=(your path which can include folder and subfolders if they already exist) type=expandable maximum=(size of virtual disk, 30000 is equal to roughly 30GB).

Enter in the following example statements as seen in the picture below while substituting the valid path and size:

DISKPART>  create vdisk file=d:\win2012virtual.vhd type=expandable maximum=30000

DISKPART>  attach vdisk

DISKPART>  list disk

You should now see the new virtual disk listed as if it were a physical disk, right under the real hard drive in the computer.

create vdisk

Type in ‘exit’ and hit ‘Enter’.  Type in ‘exit’ again and hit ‘Enter’.  You will be back at the disk selection window. Click on the ‘Refresh’ button on the screen. 

Refresh and select the drive

You should now see the newly created virtual disk.  Ignore the error that pops up at the bottom of the screen.  Select the new disk, and click on ‘Next’.

Installation Proceeding

The installation should proceed as normal.  Reminder, the new Windows installer will automatically create a new entry in the boot selection wizard so that when the machine is booting up you will have a choice of going back into the original OS or the new one.  If at the end of your testing you choose to stop using the new OS, just boot back into the original OS, go to the Start menu and type in ‘msconfig’.  Go to the Boot menu and remove the entry for the OS you no longer wish to keep, but also do not forget to delete the virtual hard disk file from your computer as it will just take up space.   Have fun and good luck on your testing!