How to Back Up and Restore the Windows Registry

written by: Leon Gualee; article published: year 2006, month 10;


In: Root » Computers and technology » Microsoft OS family » How to Back Up and Restore the Windows Registry

Dutch French Spanish Portuguese Italian German Japanese Chinese Korean Russian Arabic Bookmark and Share this Article

Before diving into Registry modifications, I'll talk about backing them up. Every computer book I've seen stresses these facts:

1.
There is no Undo key in the Registry Editor.

2.
Improper changes to the Registry can keep Windows from booting, or can make subsystems fail to work.

3.
You should always perform a system backup, or at least back up the entire Registry before you make any changes to the Registry.

In the spirit of full disclosure, I have to tell you that items 1 and 2 are completely true, and I've never followed the advice of item 3 myself. Maybe I'm an idiot, maybe the warnings are a bit too strident, or maybe it's something in between. But, especially with Windows XP's System Restore feature to do all of the work for you, there's really no harm in taking a few extra moments to protect yourself against a preventable bad outcome.

You can back up the Registry in Windows XP in five ways: You can back it up as part of a regular disk backup; you can selectively back up portions of the Registry by exporting the keys with the Registry Editor; you can create a System Restore Point; you can use the command-line application REG.EXE; or you can use a special-purpose Registry backup program.

Registry Backup and Recovery with Windows Backup

Windows XP includes a simple, straightforward backup and restore utility called NTBackup that you can use to back up your entire system, including data files, system files, and Registry files.

To back up only the Registry, follow these steps:

1.
Click Start, Run, and type ntbackup in the open box. Click OK.

2.
If the backup utility starts in the wizard interface, click the Advanced Mode option in the body of the main paragraph to take you out of the wizard and display the tabbed Backup Utility interface.

3.
Select the Backup tab and select the System State option in the tree in the left pane. The System State is composed of the Registry, the boot files, the Active Directory files, and the certificates.

4.
Enter a backup filename in the designated box. It's best if you save this backup in another computer's shared network folder, or on a removable disk.
5.
Click the Start Backup button. You are then prompted for a backup description. Select the option to Replace the Data on the Media with This Backup.

6.
Click the Advanced button and uncheck the option to Automatically Backup System Protected Files with the System State. This ensures that you're grabbing only a backup of the Registry and cuts your backup file down from 1GB to somewhere between 10 and 50MB, depending on your Registry size. Click OK, and then click Start Backup.

7.
The Backup Progress dialog displays. When the job completes, click Close.

To restore the Registry from a backup made with NTBackup, follow these steps:

1.
Click Start, Run, and type ntbackup in the open box. Click OK.

2.
If the backup utility starts in the wizard interface, click the Advanced Mode option in the body of the main paragraph to take you out of the wizard and to display the tabbed Backup Utility interface.

3.
Select the Restore and Manage Media tab.

4.
Select Tools, Options, Always Replace the File on My Computer because your Registry files already exist. Click OK.

5.
In the right pane, expand the list of catalogued backups until you find the one you want to restore. If you do not see your backup job in the list, click Tools, Catalog a Backup File, and enter the location for the backup file in the resulting box. Select the applicable backup set and select System State in the left pane.

6.
Click Start Restore. A dialog warns you that System State is always restored to the current location. Because that's what you want to happen, click OK.

7.
Click OK on the Advanced Options dialog.

8.
Confirm the proper name and location of the backup set, and then click OK.

9.
When the restore completes, you must restart the system to successfully load the restored Registry files.

Caution

Do not test this procedure out on a properly functioning system. This is a drastic procedure meant only for recovering from Registry-related disasters and should not be attempted unless absolutely necessary, or if you are working on a lab machine specifically set up to test this process

Exporting and Importing Registry Files with the Registry Editor

The Registry Editor that is included with Windows XP allows you to selectively export anything from a single subkey to an entire Registry key. If you're performing significant modifications, this is a good way to ensure that you can figure out what the original values were if you need to roll back your changes.

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

1.
Click Start, Run, type regedit, and click OK.

2.
Select the key you want to back up from the list in the left pane.

3.
Select File, Export.

4.
In the Common File dialog, select a directory and enter the filename where you would like to save the exported Registry entries.

Caution

The default extension for an exported Registry file is .REG. Double-clicking on a .REG file automatically imports the file into the Registry after providing a single confirmation box. To prevent too-easy accidental Registry imports, I suggest you save exported Registry files as text files, with the .TXT extension.

5.
Select Selected Branch in the Export Range option box, and click Save.

Because this is a plain-text file, you can open it in Notepad to see the contents. I often use this method to deploy changes to several computers: I make limited Registry changes on a single system, export the change as a .REG file, edit the file down to just the modified entries, move the file to a network folder, and import the file on other machines.

Importing a Registry file exported through the Registry Editor is just as straightforward as exporting:

1.
Click Start, Run, type regedit, and click OK.

2.
Select File, Import.

3.
In the Common File dialog, enter the filename containing the data you want to import.

4.
Select Open.

Importing a Registry setting through the Registry Editor overwrites existing keys or values and adds missing keys or values, but it does not delete extra keys or values that are not contained in the Registry file. However, you can use a Registry file to explicitly specify subkeys or values to delete.

Note

Remember when I suggested changing the extension of the previous Registry file from .REG to .TXT so you wouldn't accidentally import the settings? You can use the inverse to enable a two-step, REGEDIT-free Registry file import. Simply rename the Registry file you want to import with a .REG extension. Then double-click the Registry file to quickly import the contents of the file into your Registry. You can't back out of the import after you've confirmed it exists, so ensure you know what you're importing before you run the REG file.


Backing Up with System Restore

A System Restore Point allows you to restore your computer to a previous state, rolling back changes to device drivers, system files, and the Registry. By manually requesting that Windows create a Restore Point before you forage into the Registry, you can make changes and easily roll them back if something doesn't work.

Command-Line Backup and Restore Using reg.exe

A command-line Registry manipulation tool called reg.exe is included with Windows XP. This tool is useful for selectively backing up or restoring specific Registry subkeys. Numerous functions are available in reg.exe, including Registry exporting and importing.

Note

You can do quite a few things with reg. Use the command reg /? for a complete usage syntax of the command.


To back up a Registry key using reg.exe, use the following syntax:

reg export rootkey\subkey filename  
For rootkey, you can use the abbreviations HKLM, HKCU, HKCR, HKU, or HKCC. Subkey must be the full name of a Registry key under the selected root. Filename is the name of the file to which you want to save the exported data.

To restore a Registry key using reg, use the following syntax:

reg import filename  
When importing, filename can be any file created by reg export, from the regedit Registry Editor's Export command, or created manually with a text editor.

Disclaimer

1) E-articles is not responsible for the information contained by this article as well for any and all copyright infringements by authors and writers. E-articles is a free information resource. If you suspect this article for any copyright infringement, please read the terms of service and contact us to investigate the problem.
2) E-articles is not responsible for inaccuracies, falsehoods, or any other types of misinformation this article may contain and will not be liable for any loss or damage suffered by a user through the user's reliance on the information gained here.

link to this article