How to Back Up and Restore the Windows Registry

by Leon Gualee.

Share
|
Homepage | Submit your article | Contact | TOS
More articles on microsoft os family  

You are here: Categories » Computers and technology » Microsoft OS family

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.
Leave a comment or ask a question
Total comments: 0

Microsoft OS family Disclaimer

  • The e-articles directory is not responsible for any and all copyright infringements by writers and authors. If you suspect the information contained by this page for any copyright infringements, please contact us to investigate the issue
Internet Explorer 8 Automatically Completes Address - Internet Explorer 8 with Windows 7 helps you surf the Internet quicker. With the latest version of IE you need not open up a new window to find information such as driving directio (more...)
Setting up a shared internet connection in Windows XP - If you have one computer connected to the internet (from now on called the "server"), and another connected to that computer (from now on called the "client") via a wirel (more...)
Find and Replace Registry Keys from a Command Line - Using the Regfind utility, you can easily search the Registry for a value, regardless of the key, and replace it. Regfind (from the Windows 2000 Server Resource Kit) can be an invalua (more...)
How to Execute a Command on Each Computer in a Domain - This handy script lets you easily run any command on a specified subset of computers in your domain. Running the same command on multiple computers in your domain can be tedious indeed, (more...)
Top Five Tools in Windows 2000 - Here's one IT professional's take on five third-party tools for Windows 2000 every system administrator should have. There can be no doubt that with every release of Microsoft's opera (more...)
Designing Active Directory for Exchange Server 2007 - Active Directory (AD) is a necessary and fundamental component of any Exchange 2007 implementation. That said, organizations do not necessarily need to panic about setting up Active Directory in (more...)
Delegate Control of an OU to a User - Rather than use the Delegation of Control Wizard, use this script to delegate authority over an organizational unit (OU) to a particular user. By delegating administrative responsibilit (more...)
Automatically Windows Log On After Booting - It's sometimes convenient to configure machines to log on automatically when booted. Here are three ways to do this. In all versions of Windows that are based on Windows NT (including W (more...)
Bit Mapped Graphics - Windows marked the transition of the primary operating mode of PC display systems. From character-based displays, Windows ushered in the age of the bit-mapped display. Bit-mapped graphics (more...)
The Evolution of Microsoft Windows ~ Windows XP 64 bit Editions - The CPU story is not over, however. The need for processors capable of handling far more than 4GB of memory has led to development of two competing 64-bit architectures. Intel developed and pro (more...)

 
free content
    Copyright © 2006 - 2012 e-articles.info.
The texts, articles and tutorials in the directory are property of their respective owners and authors.