Backing Up and Restoring the Registry


Because the Registry is now the one place where all the Windows hardware and software settings are stored, it's also the one thing that Windows absolutely needs to run. You will hear dire warnings from Microsoft, other computer books, installation manuals, and now me: It's very important to back up the Registry before you edit it. If a critical entry is lost or changed incorrectly (for example, one that holds the name of a driver file for your graphics display adapter), Windows may not be able to start at all.

If you have a Registry problem, before attempting any drastic measures, see "Recovering from a Suspected Registry Problem" in the "Troubleshooting" section at the end of this chapter.



Make it a habit to back up the Registry every time you back up your hard disk and before you install new hardware or software. I can tell you from personal experience that without a Registry backup, something as common as a bad graphics card installation program can cost you a whole day of trying to get your system to boot again! Windows XP Professional has some built-in protection to help avoid this type of disaster, but you should still take your own precautions.

Backing Up the Registry

You can back up the Registry in Windows XP in three main ways: You can back it up as part of a regular disk backup, you can use the Registry Editor to save a key to a disk file, or you can use a special-purpose Registry backup program.

I suggest that you set your favorite disk backup program to back up the Registry files every time you back up your hard disk. Before you install a piece of new hardware or a significant software package, do a full disk backup, including the Registry. Before you manually edit the Registry for other purposes, back up the Registry by any of the means I'll discuss in the next few sections.

TIP

An Automated System Recovery backup is a fourth Registry backup of sortsit saves the most critical, hardware-related information from the Registry on the Emergency Repair Diskette (ERD), then puts everything in the larger backup set. An up-to-date ERD can help you get Windows back on its feet if you have a Registry or other disaster. If you really want to get a gold star for preparedness, update your ERD every time you've added new hardware, after it has proven to be stable and work correctly.


To learn how to make an Emergency Repair Disk, p. 1142.


Backing Up with Windows Backup

To run the Backup utility included with Windows XP Professional,

1.

Open the Start menu and choose All Programs, Accessories, System Tools, Backup.

2.

Click Advanced mode, and select the Backup tab.

3.

Check System State as shown in Figure 32.2. If you want to back up more than just the Registry, select any other drives and/or folders you wish to back up.

Figure 32.2. Check System State to add the Registry to your backup set.


4.

Select a destination for the Registry backup. You can save to a tape drive, network drive, Zip disk, or to a file on your hard drive (you could enter "C:\regback.bkf"). Select the desired backup destination (for example, "File"), and enter the desired location under Backup media or file name. Click Start Backup.

5.

Click Advanced and uncheck Automatically Back Up System Protected Files with the System State. (This will cut the backup from more than 1GB of data down to around 10MB.) Click OK.

6.

Check Replace the data on the media with this backup, and then click Start Backup.

The System State backup option backs up the Registry along with boot files, Active Directory files, and Certificates. For this reason, it is a good idea to select System State every time you make a backup, to disk or tape.

Now, with this backup on hand, if Registry problems occur after your installation, you can use the Backup utility again to restore the Registry to its previous state.

Although it's best to perform a full backup to tape, disk, or other high-capacity storage media, you can perform a quick System State backup to a local disk file in preparation for adding new hardware or software.

NOTE

With Backup, you cannot save the System State of a remote computer, only the local computer. For remote or centralized backup servicesto back up the Registries of all the computers on your networkyou need to buy a third-party backup program. If you're managing a large network of computers, you should definitely investigate centralized backup systems.


Backing Up with Third-Party Disk Backup Software

Third-party disk backup software made for Windows XP Professional will include an option to back up the Registry. Be sure to check this option whenever you are backing up your hard disk. It may have options like the Windows Backup program to back up just the Registry and to back up to a disk file, so you can make a quick backup before attempting Registry edits.

You should check your backup software's manual for instructions on saving Registry and system information when you back up. I suggest that you always include the Registry in your backups.

Backing Up with Third-Party Registry Backup Software

There are third-party programs specifically designed to back up and restore the Registry and other critical Windows files. For example, SuperWin's WinRescue XP program (www.superwin.com) can not only back up and restore the Registry, but can defragment the Registry's files and work magic to revive a non-bootable Windows system. If you're a Registry hacker, it would be worth buying a Registry backup tool.

These programs will come with their own extensive instructions on backing up, restoring, repairing, and maintaining the Registry.

Backing Up with Regedit

The Registry Editor, called Regedit, has a mechanism to export a set of Registry keys and values to a text file. If you can't or won't use a more comprehensive backup system before you manually edit the Registry, at least use this editor to select and back up the key that contains all the subkeys and values you plan to modify. This way, you can back up all the sections you plan to edit in one backup.

That way, if it's necessary later, you can restore these exported files, recovering any changed or deleted keys and values. Remember, though, that Regedit cannot remove entries you added that were not in the Registry before the backup! So, if an entry you add causes problems, the Registry Editor backup will not help you recover.

To back up a key and its subkeys and values, follow these steps:

1.

To run Regedit, choose Start, Run. Type regedit and click OK.

2.

Select the key you plan to modify, or a key containing all the keys you plan to modify, in the left pane.

3.

Select File, Export (see Figure 32.3).

Figure 32.3. You can save a Registry key and any keys and values it contains with Regedit.


4.

Choose a location and filename to use to store the Registry keys. I usually use the desktop for temporary files like this, so I'll see them and delete them later.

TIP

For backup purposes, I recommend not using the default extension .REG. This extension is associated with Registry entries in the Windows Explorer, and selecting a REG file in Explorer restores it to the Registry. This operation is far too serious to have happen with just a mouse click or two.

5.

Select All Files from the Save As Type list, and enter a name (possibly with an extension other than .REGfor example, c:\before.sav).

6.

Click Save. The chosen key or keys are then saved as a text file.

TIP

You can use this technique to copy a set of keys and values from one section of the Registry to another. First, export the desired key and values to a file. Edit the file with Notepad, and use the Edit/Replace menu to change all of the key names to the desired new location. Then import the file back into the Registry. I have used this method to copy a group of Registry entries under HKEY_CURRENT_USER to HKEY_USERS\.Default, for example, so that all newly created user accounts will have the desired setting.


TIP

You can also use exported REG files to simplify the job of copying the same set of registry entries to multiple computers. See the "Tips from the Windows Pros" section at the end of this chapter for details.


Restoring the Registry

If you've made Registry changes that cause problems, you can try to remember each and every change you made, re-enter the original information, delete any keys you added, and thus undo the changes manually. Good luck! If you were diligent and made a backup before you started, however, you can simply restore the backup and have confidence that the recovery is complete and accurate.

If you think you have Registry problems, see "Signs of Registry Problems" in the "Troubleshooting" section at the end of this chapter.



To restore a Registry backup you made, follow the steps described in the following sections.

Restoring the Registry with Driver Rollback

If you encounter problems immediately after installing or updating a device driver, you might be lucky enough not to need to manually restore the Registry. Windows XP may be able to help you automatically. Use the Device Manager's "Roll Back Driver" feature to see if this fixes your problem.

To see detailed instructions on updating device drivers, p. 1178.


Restoring the Registry from Windows Backup

The Windows Backup utility's Restore feature lets you replace Registry and other System files saved before a failed installation or change. This step is fairly drastic, so be sure you've exhausted the less invasive procedures before you resort to this method. If you did a full backup, you're fairly safe because all program files will be restored along with the Registry. If you backed up only the Registry itself, there's a chance that the old Registry entries won't solve any problems created by replaced system programs.

Follow these steps to restore the backup:

1.

Click Start, All Programs, Accessories, System Tools, Backup (or choose Backup if it's on your Start menu).

2.

Click Advanced Mode, and select the Restore and Manage Media tab.

3.

Select Tools, Options. Choose Always Replace the File on My Computer. (You must choose this option because you're replacing files that exist but contain the wrong information.) Then click OK.

4.

Expand the list of cataloged backups (see Figure 32.4). Then locate the backup you want to restore, and check System State. If you want to restore other files and/or volumes backed up at the same time, check them as well.

Figure 32.4. You can restore the Registry by restoring a System State backup.


5.

Select Start Restore. A dialog box then warns you that System State is always restored to the current location. Click OK.

6.

When a dialog box offers you Advanced options, just click OK to proceed.

7.

A dialog box appears to let you enter the name of the backup set file you're restoring. Enter the name you used when you made the backupfor example, c:\before.bkf. Correct the name if necessary, and click OK.

8.

When the backup is complete, Backup asks you to restart the system. You really must reboot now because the Registry files have not actually been restored. The recovered Registry data has been set aside and will only be installed the next time Windows starts. If you make any other Registry changes before restarting, they will be lost when the restored files are installed.

Restoring the Registry from Regedit

If a Registry editing session has gone awry, and you need to restore the Registry from a Regedit backup, follow these steps:

1.

In Regedit, select File, Import.

2.

Select All Files from the Files of Type list.

3.

Locate the file you used to back up the Registry key or keysfor example, c:\before.sav.

4.

Select Open.

The saved Registry keys are then imported, replacing any changes or deletions. However, any keys or values you've added to the Registry will not be removed. If they are the cause of the problem, this restore will not help.

If the Registry problems persist, you can try a rather drastic measure: You can use Regedit to delete the key or keys that were changed and then import the backup file again. This time, any added keys or values are removed. I suggest you try this approach only with keys related to add-on software, not for any of the Microsoft software or hardware keys.

TIP

My final word on Registry repair: If you encounter problems with the Registry entries for hardware or for Windows itself, and restoring the Registry doesn't help, you are probably better off reinstalling Windows or using the Emergency Recovery procedure than trying any further desperate measures to fix the Registry.


TIP

If you encounter what you think are Registry problems with add-on software, your best bet is to uninstall the software, if possible, and reinstall it before attempting any Registry restores or repairs.




Special Edition Using Microsoft Windows XP Professional
Special Edition Using Microsoft Windows XP Professional (3rd Edition)
ISBN: 0789732807
EAN: 2147483647
Year: 2003
Pages: 450

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net