XP Mode and Virtual PC in Windows 7: Test Everywhere
There was a time when we had to test our programs on a lot of different machines. See the February 2000 ASPects and my article “A Computer for All Seasons” for the old-fashioned approach: interchangeable hard drives, with a different version of Windows on each drive. There are also drive imaging approaches, and multi-boot options. All those methods still work, but virtualization is finally available on workstation PCs, and is worth setting up.
In Windows 7, there’s a new XP Mode, available as a free download for Windows 7 Professional, Ultimate, or Enterprise only, which will run a fully-licensed copy of Windows XP Professional, 32-bit with Service Pack 3 as an isolated virtual machine, complete with Internet Explorer version 6. The basic installation of XP Mode is useful for running programs not compatible with Windows 7, and that’s the main advantage listed in the Microsoft web pages about XP Mode, but it is also useful for testing new programs for XP compatibility, testing web pages in Internet Explorer 6, and with a few additional downloads, testing Internet Explorer 7, Server 2003 R2, Server 2008, and, well, most Microsoft server and enterprise products–just search http://www.microsoft.com/downloads for ‘vhd’ for downloadable drive images–there are 43 search results as of February. Most of these are time-limited; be sure to read the restrictions online.
The installation instructions for XP Mode online are scattered. The information isn’t really clear without some digging. I’ve found the references and can add some tips.
First Project: Antique Software Installation
I have an old accounting program that I’m not ready to more away from. It’s from 1999, but it’s clearly compiled as a 16-bit program for Windows 3.1; it can only manage 8-character filenames with a 3-character extension, and it really can’t cope with networks. It runs well in 32-bit Windows Vista, but switching my main machine to 64-bit Windows 7 Ultimate was just too much for it to handle. It’s an antique. Here’s how to make it run.
Check the Computer First
XP Mode requires Windows 7, Professional or higher, and a CPU that supports hardware virtualization, in a motherboard that has virtualization turned on in the BIOS. You can look up your CPU; there are some links to Intel and AMD from the Virtual PC 2007 page, here:
Basically, most mid-range or higher CPUs from the last year should support virtualization. There’s a handy program online at the Gibson Research website, in the free utilities, that will identify if your CPU is ready:
This is the result for an AMD Athlon 5050e, dual-core, 2.6 GHz, low-power, 65-watt CPU–it supports virtualization.
Microsoft has placed much of the XP Mode information here:
There’s a big orange button to “Get Windows XP Mode and Windows Virtual PC now”, leading to a 4-step download page, including options for Windows version and language.
Download both the XP Mode VHD file and the Virtual PC installation file. Run the installation on the VHD file first. After it completes, there will be NO new icons on the start menu or the desktop–that’s normal. Then run the Virtual PC installation–the program actually displays a product name of KB958559.
After the required restart, go to the Windows 7 start menu, choose Windows Virtual PC, and below it, click on XP Mode. There will also be a link for Windows Virtual PC that does nothing but open a directory window–save that for later. After some introductory screens, Windows XP will start, and look just like we’re used to seeing it. What’s different is the drive list. Here’s XP, in 7, showing both drive lists. Note that the drive sizes don’t match; C: in XP is 126 Gb, 2 Gb used, and in 7, same computer, it’s 294 Gb, 30 Gb used, and the D:\ partition isn’t in XP. But all the Windows 7 drives show up as ‘Other’, where the missing D: partition is ‘\\Tsclient\D’:
Next step is to tame Windows XP. It’s complaining that there is no antivirus, and it wants to install patches. If the virtual machine won’t normally be online and is strictly for testing applications, just set the Internet Explorer security options for the ‘Internet Zone’ to high. If you’ll actually use XP Mode for running old applications, allow the patches and add a basic antivirus–I used Microsoft Security Essentials–it’s free and fast, and won’t expire until the next major version upgrade:
OK, time to setup the antique accounting software. It installs, which is more than it could do in Windows 7, but it can’t navigate to the network drive where the data file is, although it’s on the same hardware, and I don’t want to store data inside a virtual hard drive–it’s compressed there, and difficult to back up. The accounting software can’t navigate to the pre-shared “\\Tsclient\D\Accounts” folder, or to a mapped drive letter. The fix is to place a shortcut on the XP desktop to the data file on the network-location hard drive, and double-click that, which then opens the antique.
Printing is required; I took the easy way and added a network printer and installed a free PDF printer driver, but XP Mode also has built-in support for connecting to a USB printer. I just elected not to use the mounting and unmounting involved with USB devices.
Done, if all that’s needed is running an old program. But Virtual PC can do more.
Adding another Virtual Hard Drive
For testing web sites under different versions of Internet Explorer, this box is already equipped with IE 6 and IE8. In theory, I could duplicate the XP Mode VHD installation, and upgrade one of the installs to IE7. For this example, I chose instead to download a trial VHD file from Microsoft of IE7 running in XP, and set it up as an additional virtual machine. From http://download.microsoft.com, search for “Internet Explorer Application Compatibility VPC Image” or go here for a selection of pre-built Internet Explorer virtual machines:
I downloaded the IE7-XPSP3.exe file which contains a Windows XP SP3 with IE7 VHD file, and expires April 1, 2010. It’s 813 Mb, and after running, it will result in a 2.3Gb VHD file, which does, well, nothing. This is where the Microsoft instructions skip past a few steps.
The missing step is that you can’t run a VHD file. You have to create a virtual machine, and choose the VHD to install in the machine, which will result in a VMCX file, which you can run in Virtual PC. There’s a useful set of videos online to explain the basics, but I’ll suggest skipping directly to the last video first, “Windows XP Mode Deployment Guide for IT Pros.” It’s a half-hour long, and covers all the steps, including mounting a VHD, copying and modifying a VHD, creating a Sysprep-ed image for deployment across a network, and controlling whether a program installed in the VHD appears in the Windows 7 start menu.
To create the virtual machine, you’ll use that Virtual PC link in the start menu; it leads to a folder. In the bar above the nearly-empty file list, click on ‘Create virtual machine.’ Make up a descriptive name for the machine, and choose a location (path) for the machine. Click Next.
Next, choose the memory and networking options–the defaults are generally OK.
At the ‘Add a virtual hard disk’ screen choose the second option to ‘Use an existing virtual hard disk’ and browse to the downloaded VHD file. Click ‘Create’ and Virtual PC will complete the process. The IE7 demo VHD looks a little different:
That’s it; the basics are completed. The result is a single computer, shown below, that can simultaneously run Internet Explorer 6, 7, and 8. Remember to disable automatic updates on both virtual machines, or exclude the updates that install IE 7 & 8, or Windows will happily turn your configuration into three copies of Internet Explorer 8.