Complete Guide To Using VHDs, Windows Virtual PC, Windows XP Mode & ISOs On Windows 7
October 28, 2009Windows 7 brings with itself the industry’s new favorite toy – Virtualization to your desktop. The three most notable features in Windows 7 are:
-
Built-in ISO Burner
-
The ability to boot using VHDs
-
XP Mode (XPM) – a virtual XP machine to tackle legacy app issues
Using machines in a virtual environment is really fun, being able to try out OSs without having to restart to change the OS is time saving, though there’s a compromise on performance. In this article I’ll talk about Windows Virtual PC, creating VHDs, native boot into VHDs & optical drive emulation.
Update: Microsoft has dropped the need to enable Hardware Virtualization, you can skip Part 1. However, having Hardware Virtualization will definitely improve performance.
Part 1: Enabling Hardware Virtualization
Before we begin, make use of this tool to check whether your processor supports hardware virtualization and if need be, enable it via BIOS. This is required for Windows XP Mode and better support for a virtual environment. We’ll make use SecurAble to determine Hardware Virtualization.
There’s a tool by Microsoft as well that tells you whether Hardware Virtualization is supported on your PC:
Part 2: Windows Virtual PC
Once all’s set, we’ll go on and download Windows Virtual PC (it still in RC for the public but has RTMed and the final bits are available for MSDN & TechNet subscribers.) Windows Virtual PC replaces Virtual PC 2007. Not much has changed, it still works pretty much the same way but has tighter integration with Windows 7. Windows Virtual PC now has support for USB drives as well, which might I say is a #WIN!
One can install Linux distros on it as well. And though unsupported by Microsoft, Windows Virtual PC works well on Windows Home Premium.
NOTE: Windows Virtual PC is required for XPM.
Jumplists:
Explorer:
Start Menu:
If you wish to launch an application from your host machine directly into your virtual machine you can use a utility created by MVP Woflgang Unger. The utility creates an entry in the Right Click menu for the applications that will allow you launch the application directly into the virtual machines setup on the host. Screen shots:
The utility has parts to it:
- one is a standalone launcher for the host machine
- two is an installer for the virtual machine
Once downloaded do the following:
- Extract the contents to any folder, among other things there will be a file named VMLauncher.exe & a folder named Client
- Start your virtual machine and navigate to the Client folder
- Run the VMLauncher.exe in the folder named Client and install it.
- Now, on the host machine, run the VMLauncher.exe file (not the one in the Client folder.)
- You will see the virtual machine listed in this window. Screen shot:
You should now have the virtual machine in the right click context menu as well.
NOTE: This works only for Windows based virtual machines.
Tipped by the MVP Blog.
Part 3: Setting up a Virtual Machine
Windows Virtual PC works fine on Home Premium and above editions of Windows 7. Once you’ve downloaded Windows Virtual PC, you can install your own copy of Windows XP (and not necessarily use XPM), Vista, Server or a Linux distro as shown in the earlier article. To create Virtual Machines:
Start –> Run –> c:\Windows\System32\VPCWizard.exe
And you should get this screen:
To boot from the physical drive:
Tools –> Settings
If you’re installing a Windows machine, after installation you should install the Integration Components for seamless integration, the biggest advantage is the cursor movement between the VPC & desktop. To do this:
Tools –> Install Integration Components
Once you’ve installed and all’s fine, you can configure your machines without having to start Virtual PC. This is possible due to Virtual PC’s shell integration with Windows 7. In order to do this:
Use Windows Virtual PC Jumplist and click on Manage virtual machines alternately you navigate to C:\Users\<username>\Virtual Machines Here, simply select the VPC instance you want to configure and press Settings in the taskbar below the address bar. Screenshot:
Part 4: Windows XP Mode & XP Mode Applications
Windows XP Mode has been introduced with Windows 7 to enable better legacy compatibility support for corporate users and XP Mode Applications is its biggest advantage. XP Mode is a simple install that will create a virtual machine of Windows XP with Integration Components installed. Officially Microsoft has made XPM as a free download for Windows 7 Professional & Ultimate/Enterprise users. However, it should work fine on Home Premium as well if the setup is run (I haven’t tried it.)
XP Mode’s advantages for users are:
-
Ease of setup
-
Run applications in XPM as if you’re running them natively on Windows 7 (this is not like setting compatibility mode for applications.)
Once you’ve run the setup, start your XP machine and install your XP specific applications. Then on your XP instance create a shortcut of the application in:
C:\Documents and Settings\All Users\Start Menu\Programs
This will allow you to run that application without having to start the XP machine. To run this application in Windows 7, navigate to:
Start –> Programs –> Windows Virtual PC –> Windows XP Mode Applications
Here’s the golden oldie Windows Media Player Classic running as a XP Mode Application on Windows 7:
Damn cool right!
In case you have an application on the host machine that you directly want to launch in any one of the virtual PCs, there’s a utility that will provide that option in the Right Click context menu.
Part 5: Creating VHDs & Converting to VHDs
-
Creating a VHD in Windows 7
Start –> Right click on Computer –> Manage –> Action –> Create VHD (screenshot):
Follow the onscreen instructions, I’d suggest you save it to a folder with no spaces in the name and the VHD should also have no spaces in the name. It’s precautionary.
-
vmdk to vhd
VMWare & Virtual Box are the most widely used virtual machine environments and unfortunately neither of them save discs in the VHD format. However, you can convert VMWare virtual discs (*.vmdk) to VHD within a couple of clicks using a handy tool – vmdk2vhd. It’s pretty simple to use, conversion time depends on the size of the disc. Screenshot:
I’ve not been able to find a similar tool for Virtual Box though.
-
Physical drive to vhd
SysInternals recently released a tool that allows you to create VHDs of your physical drives. Which sounds pretty cool but I don’t really find much use besides being able to run your PC environment on another PC via Windows Virtual PC. If there was a way by which I could use it as a ghost image to restore systems that’d make this is a killer tool.
NOTE: SysInternals’ team advises NOT to use VHDs created using disk2vhd for native boot on the same system as it can lead to apocalypse.
Part 6: Native boot into virtual machines:
Yes, now you can run virtual machines of some Windows versions like a native OS by adding it in your boot selection menu. This is a Windows 7 (and Server 2008 R2) specific feature and do this, you need to keep in mind that the virtual machine you want to boot into should be setup on a *.vhd virtual disk. Virtual instances created using Windows Virtual PC are stored in the VHD format. There are two ways by which one can setup the VHD to be used: Without an OS, only the VHD. The same VHD CANNOT be used in Windows Virtual PC & for native boot.
There are two of ways using this feature:
-
Making a simple VHD and installing the OS on it like we do on a normal PC
-
Using a Windows Virtual PC VHD with the OS already installed
Both need you to attach a VHD so that Windows will treat it as a normal system hard disc. For Windows to recognize the VHD as a system OS disc follow these instructions:
-
To attach the VHD and make it a OS drive:
On the host PC start CMD in Administrator mode and enter these commands:
C:\bcdedit /copy {current} /d “OS Name”
C:\bcdedit /set {guid} device vhd=[driveletter:]\path to the vhd file.vhd
C:\bcdedit /set {guid} osdevice vhd=[driverletter:]\path to the vhd file.vhd
C:\bcdedit /set {guid} detecthal on
Here {guid} needs to be replaced a with the contents enclosed in { } once you run the first command. Screenshot:
NOTE: It is while entering the path to the drive here that having space as a character in the vhd file name or folder it is in can create issues, hence avoid.
-
Using a Windows Virtual PC VHD:
Installing the OS is simpler using this method & allows you to continue working on your PC while the OS is installed. To do this, install Windows 7 on Windows Virtual PC, once setup and Windows starts then… yes, take a minute here… and then… do this, else it won’t work… and then:
Go to C:\Windows\System32\Sysprep\Sysprep.exe
Here, check the box for Generalize and select Shutdown from the Shutdown Options dropdown. Screenshot:
After doing the Sysprep, your virtual machine will shut down. Then you need to attach the VHD and make it a system drive so that Windows knows where to boot from. To do this you’ll need to do go into CMD and enter commands mentioned in under #1 (To attach the VHD and make it a OS drive)
Upon successful execution, you can restart your PC and you shall see the new entry in your boot screen. Select and move forward :)
-
Using a newly created VHD with no OS installed
We created a VHD in part 5.1 and attached it in 6.1 To install the OS, we need to do the following:
Restart your PC and boot into the Windows install disk. Follow these steps:
-
On the Install Now screen, press Shift+F10
-
Type: DISKPART
-
select vdisk file=D:\win7vhd\test.vhd (Note: you need to change the location to where you’ve saved the VHD)
-
attach vhd
-
create part pri (to create a Primary partition on the VHD)
-
format fs=ntfs quick
Windows will create a dual boot entry for you.
Part 7: Virtual Desktops & drives:
-
Virtual Desktops
If like Linux you want to have multiple desktops, you can try out the Virtual Desktop Manager application available via Codeplex. Check it out here. Screenshot:
-
Burning ISOs
This is half-assed and lame. I mean, seriously, allowing us to burn ISOs but not being able to read them let alone edit them is stupid. But nevertheless, the feature comes in handy when our lives are being governed by Murphy’s laws. To burn an ISO, double click on it or Right click –> Open with –> Windows Disc Image Burner and Windows will take care of the rest. Screenshot:
-
Loading ISOs
Clone DVD drives have been around for some time now. Use grew thanks to pirated games. But that’s not all they’re used for. With the increase in use of ISO images clone drives are installed on pretty much every enthusiasts PC. Daemon Tools is the most widely used but I’ve had serious issues with it on Windows 7 which led me to Virtual CloneDrive and I must say this is pretty awesome. Install – mount- use – unmount. Simple. Screenshot:
-
Editing ISOs
If you want to edit ISOs, make bootable discs the I’d suggest you use UltraISO. Works pretty well.
~Enjoy
PS: I somehow managed to have 7 parts to the guide. Neat!