Hack 71 Better Registry Backups


Avert disaster by backing up the Registry so that you'll always be able to revert to a clean copy.

The Registry is unforgiving; once you make a change to it, that change is permanent. There is no undo function. To get the Registry back to the way you want it, you'll have to reedit it and remember the often arcane and complicated changes that you made?if you can. And, unlike most other Windows applications, the Registry Editor doesn't ask you whether you want to save your changes. Make the change, and it's done. To paraphrase F. Scott Fitzgerald, there are no second acts when you edit the Registry.

Because of this, you should take precautions to keep your Registry safe and ensure that you can restore it to its previous safe settings whenever you want to. The best way to do that is to back up your Registry before you edit it. You should make copies of your Registry not only to protect against accidentally doing damage while you're editing it, but also to ensure that you can restore your system in the event of a system crash.

Here are the best ways to back up your Registry:

System Restore

One of the simplest ways to back up and restore the Registry is by using System Restore. System Restore creates a snapshot of your entire system, including the Registry, and lets you revert your system to that snapshot. To use System Restore, before editing the Registry choose Start Control Panel Performance and Maintenance System Restore and then follow the wizard to create a restore point. If after you edit the Registry you want to restore it to its preedited state, use the same wizard to do so.

Backup utility

You can also use Windows Backup utility to back up and restore the Registry.

By default, the Backup program is installed in XP Professional, but not XP Home Edition. If you have the Home Edition, you must install Backup manually. For more on backup strategies, see [Hack #75].

Run the Backup utility by choosing Start All Programs Accessories System Tools Backup. If you use the Backup Wizard, when you get to the "What to Back Up" screen, choose "Only back up the System State data." Then, follow the Wizard's directions. It will back up the Registry as well as other system files, including boot files used to boot XP.

If you don't use the Backup Wizard, click on the Backup tab in the Backup utility, check the box next to System State, and then click on Start Backup. When you want to restore your system, run the Backup utility. Click Restore and Manage Media Start Restore.

Registry Editor

You can also use the Registry Editor to back up the Registry. This is probably the easiest way to back up the Registry, but it won't back up two Registry keys: the SAM and Security keys that control password policies, user rights, and related information. Unless you have a complex system with many users, though, these keys are not absolutely vital.

Run the Registry Editor by typing Regedit in the Run box or a command prompt and pressing Enter. Highlight My Computer. If you highlight an individual Registry hive instead, only that hive will be backed up. Next, choose File Export. The Export Registry File dialog box appears, as shown in Figure 7-8. Give the file a name, choose a location, and save it. For safety's sake, also make backups to another machine and to a CD.

To restore the Registry, run the Registry Editor, choose File Import, and then import the file.

Figure 7-8. Using the Export Registry File screen to back up the Registry