Thursday, August 19, 2010

How to take backup of Registry

There are three methods of backing up the registry in Windows 2003. You can backup/restore the entire Registry using the Windows Backup utility; use a little tool called reg.exe from the command line. These are explained in more detail below.
From the Start menu, navigate to Programs > Accessories > System Tools and open Backup – this will start the Backup and Restore Wizard or go straight to the Backup and Restore utility (depending on your previously chosen settings).

Browse for a location to which the backup file should be placed (ideally removable storage or another partition) and click Start Backup. A new dialog box will appear showing the status of the backup procedure. When backup is complete, press OK and close.
To restore a backup file, go to the Restore and Manage Media tab and select Tools > Catalog a backup file. Browse to the location of the backup file and select it. Choose what you want to restore (in this case it is the entire System State) and press the Start Restore button.
Importing Registry:
When you export a section of the registry, it is saved as a .reg file which, when executed, will add its values back to the registry. This is commonly used when a software vendor needs a client to enable “debug mode”, for example.
To export a registry file, select the desired key from the left pane in regedit.exe, right click and choose Export. Select where you want the .reg file to be saved, and press Save. Once the file has been exported, you can edit it using Notepad.exe or any text editor.
[HKEY_CURRENT_USER\Control Panel\Accessibility\MouseKeys]
To import a reg file, simply double click it to bring up the dialog and press Yes. The information will then be added to the registry.
Using Command Prompt
Using reg.exe you can backup and restore portions of the registry with a few simple commands. This tool will allow you to backup one subtree at a time - while the system is running.
For the purpose of this explanation I will demonstrate the uses of REG SAVE and REG RESTORE.
REG save
Use the REG save command to save root keys for future restoration. The syntax for this command is:
reg save
In my example, using the above syntax I have saved the HKEY_CLASSES_ROOT, HKEY_CLASSES_CONFIG and HKEY_CLASSES_USER subtrees, as seen below.

The Registry file will be saved in C:\Regbackup.
REG restore
Using the reg restore command you can restore keys you previously saved using the reg save command. Using my example, if I wanted to restore HKEY_CLASSES_ROOT I would run the following command at the command prompt:
Reg restore hkcr c:\regbackup\hkcr

No comments:

Post a Comment