Windows Server Cookbook for Windows Server 2003 and Windows 2000
Recipe 9.9. Backing Up and Restoring the Registry
Problem
You want to back up or restore the registry on a server. Solution
With the NT Backup utility (ntbackup.exe) you can back up the registry by backing up the System State. The System State includes such things as the files necessary to boot the system, the Active Directory database, and the registry. To restore the registry, you have to restore the System State from a previous backup. Using a graphical user interface
Do the following to back up the System State:
Do the following to restore the System State:
Using a command-line interface
The following command backs up the system state to a file: > ntbackup backup systemstate /j "<Description>" /f "<FilePath>" > ntbackup backup systemstate /j "System State Backup 1" /f "c:\sysstate.bkf"
You can't use ntbackup from the command line to restore files. Another option for backing up the registry is to use the regedit command to back up specific registry hives to a file. The following command backs up the HKLM hive to a file called hklm.hiv: > regedit /e hklm.hiv hkey_local_machine
To restore the hive, use the following command: regedit /s hklm.hiv
You can use the reg command to copy specific subkeys if you don't want to back up an entire hive. For example: > reg save HKLM\Software\Microsoft c:\backup\hklm-sw-ms.hiv
To restore the backup to the registry, use the same syntax except replace "save" with "restore": > reg restore <Key> <Filename>
Discussion
If you ever run into the case where you have a corrupt registry or perhaps accidentally deleted a section of the registry, the best answer is to restore from your last good system backup. You have to be careful though, restoring the system state restores more than just the registry including system boot files. It also includes the NTDS database for a domain controller. See Also
MS KB 318149 (How to Maintain Current Registry Backups in Windows NT 4.0 and Windows 2000), MS KB 322755 (HOW TO: Backup, Edit, and Restore the Registry in Windows 2000), and MS KB 322756 (HOW TO: Back Up, Edit, and Restore the Registry in Windows XP and Windows Server 2003) |