Restoring a system image backup on Windows 7 when system recovery fails

I was asked to look at a laptop over the weekend. It was an HP running Windows 7 Home Premium, and the user was having problems installing applications. I noticed several things about it:

  • Lots of utilities like registry cleaners, system care, driver accelerator and more were installed
  • When I tried to remove the third-party firewall and use the Windows firewall instead, the Windows firewall could not be fully enabled
  • Most applications could not be removed using Control Panel – Programs and Features
  • Right-clicking a network connection and choosing Properties gave an error

When Windows is in this kind of state it makes sense to reinstall from scratch. There was an intact recovery partition, so I backed up the data and ran system recovery. This seemed to go fine until right at the end, when it gave an error and invited me to contact HP support. Oddly, if I chose HP’s “Minimized Image Recovery” I still got an error, but it got me a working “Windows Basic” installation, but Windows Basic is not much use because of some arbitrary limitations Microsoft imposed.

Now I had a problem, in that the system recovery had successfully removed the old Windows install, but had failed to install a new one.

One solution would be to re-purchase Windows or try to get recovery media from HP, but before going down that route, I decided to use a system image backup that had been made earlier. There was a backup from a year or so ago on a USB hard drive. I booted using a Windows 7 DVD, chose Repair your computer, then System Image Recovery.

Unfortunately Windows refused to list the backed up system image, even though it was in the standard location under WindowsImageBackup. Since the backup was not listed, it could not be restored.

Fortunately there is another approach that works. A system image backup actually created a virtual hard drive (.vhd) for each of the drives you select. You can zap the contents back onto the real hard drive to restore it.

This HP has three partitions. One is a small system partition used for booting, one is the main partition (C drive) and one is the recovery partition. The main partition is the one that matters. Here is what I did.

First, I installed Drive Snapshot, a utility I’ve found reliable for this kind of work.

Next, I plugged in the USB drive and found the .vhd file. These are located in WindowsImageBackup\[NAME OF PC] and have long names with letters and numbers (actually a GUID) followed by .vhd. The old C drive will be the largest file (there are usually at least two .vhd files, the smaller one being the system partition).

Step 3 is to mount the vhd so it looks like a real drive in Windows. You do of course need a working Windows PC for this; even Windows Basic will do, or you can use a spare PC. I opened a command prompt using Run as administrator and ran DISKPART. The commands are:

select vdisk file=”path\to\vhd\filename.vhd”

attach vdisk

I generally leave DISKPART open so you can detach the vdisk when you are done.

When you enter “attach vdisk” an additional drive will appear in Windows Explorer. This is your old drive. You can copy urgent documents or data from here if you like.

The goal though is to restore your PC. Run Drive Snapshot or an equivalent utility.

image

Choose Backup Disk to File. Select your old drive and back it up to an external USB drive. I hesitate to mention it, but you also need to keep the drive with the .VHD on it attached for obvious reasons! You can back up to that same drive if there is room.

Once complete, go back to DISKPART and enter:

detach vdisk

Now you need to use Drive Snapshot to restore your old hard disk. I was lucky in this case; I could run the utility in Windows Basic on the laptop itself and restore it from there. Drive Snapshot is smart enough that you can even restore the drive where it is running, after a reboot. You could also use pretty much any old version of Windows, no need to activate it, just to run the utility.

After the restore I was able to boot Windows and all was well, apart from the hundreds of Windows Updates needed for an OS that was a year out of date. In some cases though you might need to go back into system recovery to repair the boot configuration; it usually does that pretty well.