The sheer wealth of data
stored in one place makes the Registry convenient, but it also makes it
precious. If your Registry went missing somehow, or if it became
corrupted, Windows Home Server simply would not work. With that scary
thought in mind, let’s take a moment to run through several protective
measures. The techniques in this section should ensure that Windows Home
Server never goes down for the count because you made a mistake while
editing the Registry.
Backing Up the Registry
In particular, you learned how to select the items you wanted to
include in the backup. For our purposes here, the list of items
includes an Operating System item, which (among many other things)
includes the Registry hive files. So as long as you’re running server
backup regularly and the Operating System item is included in the
backup, your Windows Home Server Registry is safe.
To make sure your server’s Registry files are included in the server backups, follow these steps:
1. | Launch the Windows Home Server Dashboard.
|
2. | Click Computers and Backup.
|
3. | In the list of computers, click your server.
|
4. | Click Customize Backup for the Server. The Dashboard runs the Customize Server Backup Wizard.
|
5. | Click Next.
|
6. | Click Change Server Backup Settings.
|
7. | (Optional) Change the backup destination, and then click Next.
|
8. | (Optional) Change the backup label, and then click Next.
|
9. | (Optional) Change the backup schedule, and then click Next.
|
10. | In the Select Which Items to Back Up dialog box, activate the Operating System check box, as shown in Figure 1.
|
11. | Click Next.
|
12. | Click Apply Settings.
|
Protecting Keys by Exporting Them to Disk
If you’re just making a
small change to the Registry, backing up all its files might seem like
overkill. Another approach is to back up only the part of the Registry
that you’re working on. For example, if you’re about to make changes
within the HKEY_CURRENT_USER key, you could back up just that key, or even a subkey within HKCU. You do that by exporting the key’s data to a registration file, which is a text file that uses the .reg extension. That way, if the change causes a problem, you can import the .reg file back into the Registry to restore things the way they were.
Exporting the Entire Registry to a .reg File
The easiest way to protect the entire Registry is to export the whole thing to a .reg
file on a separate hard drive or network share. Note that the resulting
file will be about 50MB, and possibly larger, so make sure the target
destination has enough free space. Here are the steps to follow:
1. | Open the Registry Editor.
|
2. | Select File, Export to display the Export Registry File dialog box.
|
3. | Select a location for the file.
|
4. | Use the File Name text box to type a name for the file.
|
5. | Activate the All option.
|
6. | Click Save.
|
Exporting a Key to a .reg File
Here are the steps to follow to export a key to a registration file:
1. | Open the Registry Editor, and select the key you want to export.
|
2. | Select File, Export (or right-click the key and then click Export) to display the Export Registry File dialog box.
|
3. | Select a location for the file.
|
4. | Use the File Name text box to type a name for the file.
|
5. | Activate the Selected Branch option.
|
6. | Click Save.
|
Tip
You can save time by creating a batch file that uses the REG utility to export one or more keys to a .reg file. Here’s the general syntax to use:
reg export rootkey\subkey destination [/y]
Here, you replace rootkey with one of the following root key values: HKCR, HKCU, HKLM, HKU, or HKCC; you replace subkey with the path to the key you want to export; and you replace destination with the full pathname of the file to which the key should be exported. (Add the /y switch to force Windows Home Server to overwrite the destination file, if one exists.) Here are some examples:
reg export HKCU \\paulspc\backups\whs_hkcu.reg
reg export HKLM\Software\Microsoft\Windows\\paulspc\backups\whs_hklm.reg
One common Registry scenario is
to make a change to Windows Home Server using a tool such as the Group
Policy editor and then try to find which Registry setting (if any) was
affected by the change. However, because of the sheer size of the
Registry, this is usually a needle-in-a-haystack exercise that ends in
frustration. One way around this is to export some of or all of the
Registry before making the change and then export the same key or keys
after making the change. You can then use the file compare (FC) utility
at the command prompt to find out where the two files differ. Here’s the
FC syntax to use for this:
FC /U pre_edit.reg post-edit.reg > reg_changes.txt
Change pre_edit.reg to the name of the registration file you exported before editing the Registry; change post_edit.reg to the name of the registration file you exported after editing the Registry; and change reg_changes.txt to the name of a text file to which the FC output is redirected. Note that the /U switch is required because registration files use the Unicode character set.
|
Importing a .reg File
If you need to restore the key that you backed up to a registration file, follow these steps:
1. | Open the Registry Editor.
|
2. | Select File, Import to display the Import Registry File dialog box.
|
3. | Find and select the file you want to import.
|
4. | Click Open.
|
5. | When Windows Home Server tells you the information has been entered into the Registry, click OK.
|
Tip
You also can import a .reg file by locating it in Windows Explorer and then double-clicking the file. Yet another way to import a .reg file is by using the REG utility:
Here, you replace file with the full pathname of the .reg file that you want to import. Here’s an example:
reg import \\paulspc\backups\whs_hklm.reg
Caution
Many applications ship with their own .reg
files for updating the Registry. Unless you’re sure that you want to
import these files, avoid double-clicking them. They might end up
overwriting existing settings and causing problems with your system.