Article Index

Migrating a real PC to Virtual PC

I have a laptop at work that is well past its depreciation lifespan, and by the sound of the wheezing fans, I don't think it will last much longer.  It is still running Windows 2000 Pro, without the latest patches, so that I can do builds for a very fragile application I support.  I cannot keep it powered on very long, for fear 1) the hardware may finally fail or 2) the network security police will kick it off the domain.  Luckily I have a brand new desktop with plenty of hard disk space, memory, and processing power to play the role of TWO computers using Microsoft Virtual PC.  I wasn't sure if it would be possible to migrate an existing PC's configuration to a Virtual PC, but it is, and I am very happy with the results.

My initial plan was to use the Microsoft Virtual Server Migration Toolkit (I also run Virtual Server - the images are interchangeable with Virtual PC).  However, I was quickly discouraged when I started reading the requirements (a separate server running Windows 2003 Automated Deployment Services).  It seems their target market is enterprises converting a lot of legacy servers to Virtual Server -- not single users preserving an old PC.

I learned of a much better way while listening to Brian Randell's appearance on .NET Rocks! (if you don't want to listen, the Sep/Oct 2005 issue of Code Magazine has a partial transcript of the show that includes the relevant info). He seemed to hint that he was writing a book about Virtual PC/Server, and the book would probably mention this procedure, and it would be available online, but I was unable to find it, so I'll document it myself.  Brian deserves all the credit for the process; I'm just filling in the details for my specific case.

I'll refer to the PC to be virtualized (my creaking laptop) as the "legacy PC", the new desktop that runs Virtual Server as the "host PC", and the system running under Virtual Server as "virtual PC".

1) Save an image of the legacy PC in its current state using your favorite disk/partition imaging software (I used Norton Ghost 8.2 because it was available to me at work; if I had to do it on my own dime, I might have tried PartImage with SystemRescueCD).

This was the first challenge.  You cannot run Ghost in Windows running on the partition you want to make into an image.  You also can't store the image file you are creating on the disk you are backing up (for reasons that should be obvious),and I only had a single hard drive in the legacy PC.  I figured I would have to boot from a DOS floppy disk, and then connect to a network share where I could store the image.  I thought this would be much harder, until I discovered Bart's Network Boot Disk.  It was easy as:

  1. create the network boot disk floppy on the host PC
  2. share the folder containing the Ghost software on the host PC
  3. share another folder on the host PC that will store the legacy PC's image
  4. reboot the legacy PC into DOS using the network boot floppy disk (my NIC and network settings were all detected automatically)
  5. map a drive (G:) to the ghost software share on the host PC
  6. map a drive (I:) to the image share
  7. run the DOS version fo Ghost from G, select the disk/partition to backup, and save the image to I:

2) Prepare the legacy PC for distribution. Brian said to "sysprep" the PC so that it will detect hardware on the next boot; a verb that was new to me.  With a quick search, I learned he was referring to the Windows System Preparation Tool (there are different versions of the tool for each OS).  There seemed to be a lot of documentation for sysprep, and a whole lot of options that can be configured through an .inf file.  I was impatient.  I downloaded the tool to my legacy PC, extracted it, and double-clicked sysprep.exe without any customization.  I accepted the warning that my OS would lose some key configuration (which is why we made the backup image in step 1) and proceeded.  It automatically shuts down the PC when it is complete.  DO NOT start the PC into Windows at this point or you will have to start over!

3) Save an image of the legacy PC in its new "sysprepped" state, using the same process used in step 1.

4) Create a new Virtual PC/Server on the host PC.  I was able to give it the same amount of RAM and same size hard drive as the legacy PC, but I don't think this is required (of course the virtual hard drive has to be at least big enough to hold the image data).  Make sure to setup the network card on the Virtual PC.

5) Import the legacy PC image to the virtual PC. 

  1. put the network boot floppy in the disk drive of the host PC
  2. configure the virual PC so that it captures the physical floppy disk drive
  3. turn on the virtual PC - it should boot into DOS from the network boot disk
  4. map the same drives (G: and I:)
  5. run Ghost and restore the sysprepped image created in step 3 to the virtual PC's hard drive

6) Complete the Windows install.  After the image is copied to the virtual PC, reboot the virtual PC and you should see the Windows startup screen.  In my case it hung for a very long time on the Windows 2000 graphical boot screen, to the point that I suspected it had failed.  But this is the expected behavior.  Windows is going through its whole installation routine where it has to take inventory of all of the hardware on the new system.  I eventually saw new "setup" screens that re-assured me that the system was behaving correctly.  I was then surprised when I was prompted to enter my 25-digit product key.  Since all of our PCs are built using corporate images, and I don't have access to the Volume License edition we use internally, I had no idea how I would find out my product key.  I tried the MSDN product key without success.  What to do?  The process takes a slight detour (I don't think Brian mentioned this part):

  1. Restore the ORIGINAL backup image of the legacy PC to the legacy PC (using the same network boot disk + Ghost process).
  2. Boot into Windows on the legacy PC (it should not be back to the state before anything was changed)
  3. Download and run keyfinder.exe from Magical Jelly Bean Software
  4. Enter the product key from the legacy PC on the waiting virtual PC

The rest of the Windows installation was pretty straightforward.  I was able to join the domain (using a new hostname for the virtual pc) and everything came back up exactly as it was on the legacy PC.  All applications, all user profiles (including domain accounts) and preferences, everything.  There is really no difference between the new virtual PC and the old, legacy PC running on failing physical hardware.  I took one additional step as a precaution:  shutdown Windows and turn off the virtual PC, and then copy the virtual hard drive (.vhd) file to a backup location on another server.  Since this legacy PC's functionality is so important, I didn't want to risk losing it to a hard drive failure on my host PC.

Keep in mind that none of this is supported or recommended by Microsoft.  They offer the VSMT for servers, and that's it.  Make sure you understand all of the licensing issues around Virtual PC, sysprep, etc.  I have no idea how well this would work with Windows XP (or 2003) and its activation process (which would notice the drastic change in hardware when you migrate the OS).

Update: The Microsoft Virtual PC Guy describes another process with more detail.

Comments

Nice little process! I remember doing the first part of that (but creating my own network boot floppy back then..) to extract people's HD image to transfer to a new machine some years back. ;)

Anyway.. my point.. The way I read the MS license - correct me if I'm wrong - but IF the Laptop/Legacy PC came with Windows installed, that Windows is Tied to that Machine, and not licensed to run anywhere else. So, technically, you need to purchase a new license of Windows to do what you've outlined above... but if you bought the Windows OS separately, you're ok. Yes?
Andrew - September 24, 2005 06:25pm
I'm in same situation as you were and I'm glad to find your post. I'm planning on attempting this as soon as my replacement desktop arrives. Thanks for the write up.
Alex - September 12, 2008 10:19am