Sunday, October 31, 2010

Tip To Backup / Restore the Registry

To Backup/Restore the Windows Registry: Windows 9x
  1. If you are in MSDOS, at the C:\Windows prompt type
  2. Attrib -s -r -h C:\Windows\System.dat (press Enter)
  3. Attrib -s -r -h C:\Windows\User.dat (press Enter)
To make the backup copies type:
  1. copy C:\Windows\System.dat C:\Windows\System.000 (press Enter)
  2. copy C:\Windows\User.dat C:\Windows\user.000 (press Enter)
To Restore the Registry
  1. copy C:\Windows\System.000 C:\Windows\System.dat (press Enter)
  2. copy C:\Windows\User.000 C:\Windows\user.dat (press Enter)

Backup and Restoring Windows Registry for 2000, 2003, and XP 


Before I explain how to backup and restore the Windows NT platform Registry(Windows NT, 2000, 2003,XP). Vista is also part of the NT platform, but the Registry files are different, we'll discuss Vista in a future post. I want to explain why backing up or restoring the Registry from inside Windows NT, 2000, 2003 or XP cannot be done. Windows does not allow you to copy the Registry files. Even if you are armed with software that claims to backup and restore the Registry, the software cannot read all the protected Keys; merely makes a few notes for restoration. How can anyone think a 1 meg file will restore an 18 meg Registry. However, Winsafe XP can backup the XP Registry because it backs up the latest copy of the Registry out of System Restore. Exporting the Registry will not export all the Keys, a good example is the Security Key which is not exported at all. Therefore any backup made by a program is not a complete backup. Also, if the database of the Registry becomes corrupt you will be unable to restore inside of Windows. 
Now the next thing we must do to build our insurance policy is to backup the Registry on a regular basis. I know everyone says it cannot be done, but it can be and you'll be able to do it.If you have your Windows Drive formatted to FAT or FAT32 this is going to be easy; all you need to do is create the files mentioned below as well as a startup diskette from Windows 9x or ME.
If you have NTFS you do not need to create the bat files or the startup diskette, instead, you will need to manually type the lines at the C:\Windows prompt and install the Recovery Console .
If you have FAT or FAT32 you will need to create two bat files, one to backup and the second to restore. You will also need to create a bootup (startup) diskette . Create two text files using Notepad, "Backup.bat" and "Restore.bat" and save them in the Windows folder or the Root Drive. I am going to assume the Windows folder is on the C drive and named "Windows", if not, you will need to make the necessary changes in the files you are going to create. Create a new folder C:\Windows\Repair if it does not exist already.
Backup.bat : (Note: each new line is numbered, as the text maybe to long for one line on this page, DO NOT include the line numbers). You will need to adjust the following text to match your Windows folder and drive letter.  
1) Copy C:\Windows\System32\Config\Software C:\Windows\Repair\Software  
2) Copy C:\Windows\System32\Config\Security C:\Windows\Repair\Security  
3) Copy C:\Windows\System32\Config\System C:\Windows\Repair\System  
4) Copy C:\Windows\System32\Config\Default C:\Windows\Repair\Default  
5) Copy C:\Windows\System32\Config\Sam C:\Windows\Repair\Sam  
6) Copy C:\Windows\System32\Config\Userdiff C:\Windows\Repair\Userdiff  
Restore.bat file:  
1) Copy C:\Windows\Repair\Software C:\Windows\System32\Config\Software  
2) Copy C:\Windows\Repair\Security C:\Windows\System32\Config\Security  
3) Copy C:\Windows\Repair\System C:\Windows\System32\Config\System  
4) Copy C:\Windows\Repair\Default C:\Windows\System32\Config\Default  
5) Copy C:\Windows\Repair\Sam C:\Windows\ System32\ Config\ Sam  
6) Copy C:\Windows\Repair\Userdiff C:\Windows\System32\Config\Userdiff  
Now place both of these files in the Windows folder.  
If your Windows Drive is NTFS you will need to install the Recovery Console. To do this, either insert your Windows CD or locate your I386 folder on your hard drive. At the Start button select run and enter the following, adjusting the path as needed:
E:\I386\Winnt32.exe /cmdcon (press OK).  
Now you are ready to backup your Registry. If you have the Windows Drive in FAT or FAT32, you can insert your Windows 9x startup disk and reboot. When you reach the A: prompt you will need to type :
C: (press enter)
CD Windows (press enter)
backup.bat (press enter)  
NTFS users will need to reboot and select the Recovery Console option. Then enter your password and type each line of the bat file as outlined in this post(without the numbers and the parentheses mark) Press enter after each line.
When it is time to restore the Registry you will need to follow the same routine as you did for the backup procedure except replace the line Backup.bat with Restore.bat . 



You'll find the NTUser.dat file in a folder named the user name you logged on with, located at: C:\Documents and settings\ [logon name].
In order to make a backup of the NTUser.dat file you will need to reboot and logon as a different user. I discussed this a few newsletters ago. Then go to the folder that contains YOUR NTUser.dat file and manually make a backup. You can place it in a subfolder of the repair folder. If you have several users on your machine create a subfolder for each user naming each folder the logon name of the users. Then reboot and log back on as you normally do. Now make a backup of the NTUser.dat you used to make the other backups with.
To restore the NTUser.dat file, you will need to restore the other Registry files first using the Repair Console as previously discussed. Then you will need to reboot to Windows and logon as a different user. Find your backup NTUser.dat file and copy it back to the folder you copied it from, example - C:\Documents and settings\ [logon name]. Reboot and logon as you normally do.
Now that we have discussed how to backup and restore all the Registry files, you can see that it is not something you will do every day. So you'll need to know how to update an older backup if you need to do a restore.
As an added note, if you have Windows 2000 or 2003 you can create a System State backup which will backup the Registry, less the NTUser.dat file in the subfolder Windows\repair\Regback. You can do this everyday or two to keep a current Registry backup, you will also need to backup the NTUser.dat file as discussed above. To use the System State backup or restore, use your help at the Start button and do a search for System State Data for complete instructions.
A subscriber, Joe Fagnani, pointed out to me that he only needs to start the backup and then cancel it to get the Registry files backed up, but his are saved to the Windows\repair folder instead of Windows\repair\regback. Try it and see what works for you. You will still need to restore them the way I have explained if your locked out of Windows.
Now the only two other files you should backup each time is the System.ini and Win.ini files. you'll find them in the Windows folder.
If you need to restore with an older Registry you will need a program that updates the Registry after you get back into Windows. Registry Drill is going to be the tool you'll need. It has a unique feature; it can update the current registry with information from another.
In Windows 2000, 2003 and XP the Security Keys and many of the ControlSet Keys are controlled by Windows, so we will not be able to rewrite most of these Keys. These Keys should not have changed, unless you added or deleted users; or changed some hardware. So make sure your backups are reasonably up to date. Do the backup at least once a week, the more often the better. If you change hardware, you need a new backup right away.
Easy Desk has released a new Freeware Registry utility, called Open RegEdit. You can read about it and download it at http://www.easydesksoftware.com/openreg.htm .



0 comments:

Digg Facebook Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Google Bookmark Yahoo Add to Technorati Favorites TwitThis

Post a Comment