How to back up, edit, and restore the registry in Windows XP and Windows Server 2003
|
Article ID |
: |
322756 |
|
Last Review |
: |
July 15, 2004 |
|
Revision |
: |
6.1 |
This article was previously published under Q322756
For a
Microsoft Windows 2000 version of this article, see 322755.
For a Microsoft Windows NT 4.0 version of this article, see 323170.
For a Microsoft Windows 95, Microsoft Windows 98, and Microsoft Windows Millennium Edition version of this article, see 322754.
IN THIS TASK
|
• |
|
||||||||||||||||||||||||||||
|
• |
Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:
256986 Description of the Microsoft Windows Registry
NoteThe registry in 64-bit versions of Windows XP and Windows Server 2003 is divided into 32-bit and 64-bit subkeys. Many of the 32-bit subkeys have the same names as their 64-bit counterparts, and vice versa. The default 64-bit version of Registry Editor that is included with 64-bit versions of Windows XP and Windows Server 2003 displays the 32-bit subkeys in the following registry subkey, or "hive":
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
For additional information about how to view the registry on 64-bit versions of Windows, click the following article number to view the article in the Microsoft Knowledge Base:
305097 How to view the system registry by using 64-bit versions of Windows
Before
you edit the registry, export the keys in the registry that you plan to edit,
or back up the whole registry. If a problem occurs, you can then follow the
steps in the Restore the registry section of this article to restore the registry to its
previous state.
back
to the top
You can
follow these steps to export a registry subkey before you edit it.
Note Do not follow these steps to export a whole registry subtree.
(HKEY_CURRENT_USER is an example of such a subtree.) If you must back up
whole registry subtrees, back up the whole registry instead.
|
1. |
Click Start, and then click Run. |
|
2. |
In the Open box, type regedit, and then click OK. |
|
3. |
Locate and then click the subkey that contains the value that you want to edit. |
|
4. |
On the File menu, click Export. |
|
5. |
In the Save in box, select a location where you want to save the Registration Entries (.reg) file, type a file name in the File name box, and then click Save. |
To back up the whole registry, use the Backup utility to back up the system state. The system state includes the registry, the COM+ Class Registration Database, and your boot files. For additional information about using the Backup utility to back up the system state, click the following article numbers to view the articles in the Microsoft Knowledge Base:
308422 How to use Backup to back up files and folders on your computer in Windows XP
320820 How to use the Backup utility to back up files and folders in Windows XP Home Edition
326216 How to use the Backup feature to back up and restore data in Windows Server 2003
Use the Windows user interface
We recommend
that you use the Windows user interface to change your system settings
instead of manually editing the registry. However, editing the registry may
sometimes be the best method to resolve a product issue. If the issue is
documented in the Microsoft Knowledge Base, an article with step-by-step
instructions to edit the registry for that issue will be available. We
recommend that you follow these instructions very exactly.
back
to the top
Using
Registry Editor incorrectly can cause serious problems that may require you
to reinstall your operating system. Microsoft cannot guarantee that problems
that result from incorrect use of Registry Editor can be solved. Use Registry
Editor at your own risk.
Editing the registry involves the following six types of procedures:
|
• |
Locating a subtree, key, subkey, or value |
|
• |
Adding a subkey |
|
• |
Adding a value |
|
• |
Changing a value |
|
• |
Deleting a subkey or a value |
|
• |
Renaming a subkey or a value |
Locating a subtree, key, subkey, or value
There are five top-level registry subtreesEach of them starts with
"HKEY." In the following example, HKEY_LOCAL_MACHINE is the
subtree, SOFTWARE is the key, and Microsoft is the subkey.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft
In
Registry Editor, you can search through the keys and subkeys in the same way
that you search through your folders in Windows Explorer.
The keys and the subkeys are listed in a folder tree in the left pane of
Registry Editor. If you click a key or a subkey in the left pane, information
about the value name, the value type, and the value data appears in the right
pane.
As in Windows Explorer, each folder may be expanded by clicking the plus sign
(+) that is next to it. After a folder is expanded, the plus sign changes to
a minus sign (-).
Note When this article says to expand an item, click the plus sign
next to that item.
To locate the Microsoftsubkey that is mentioned earlier in this section,
follow these steps:
|
1. |
Click Start, click Run, type regedit, and then click OK. |
|
2. |
Expand HKEY_LOCAL_MACHINE. |
|
3. |
Expand SOFTWARE. |
|
4. |
Click Microsoft. |
Adding a key
To add a new subkey named TestSubkey to the Microsoft subkey, follow these
steps:
|
1. |
Expand HKEY_LOCAL_MACHINE. |
|
2. |
Expand SOFTWARE. |
|
3. |
Click the Microsoft subkey. |
|
4. |
On the Edit menu, point to New, and then click Key. |
|
5. |
Type TestSubkey, and then press ENTER. |
Adding a value
To add a new DWORD Value named TestDWORD and to set its value data to 1 in
the TestSubkey key, follow these steps:
|
1. |
Expand HKEY_LOCAL_MACHINE. |
|
2. |
Expand SOFTWARE. |
|
3. |
Expand Microsoft. |
|
4. |
Click the TestSubkey subkey. |
|
5. |
On the Edit menu, point to New, and then click DWORD Value. |
|
6. |
Type TestDWORD and then press ENTER.. |
|
7. |
Right-click the TestDWORD DWORD Value, and then click Modify. |
|
8. |
Type 1, and then click OK. |
Changing a value
To change the value data for the TestDWORD DWORD Value to 0 in the TestSubkey
key, follow these steps:
|
1. |
Expand HKEY_LOCAL_MACHINE. |
|
2. |
Expand SOFTWARE. |
|
3. |
Expand Microsoft. |
|
4. |
Click the TestSubkey subkey. |
|
5. |
Right-click the TestDWORD DWORD Value, and then click Modify. |
|
6. |
Type 0, and then click OK. |
Renaming a key or value
To rename the TestSubkeysubkey to Test, follow these steps:
|
1. |
Expand HKEY_LOCAL_MACHINE. |
|
2. |
Expand SOFTWARE. |
|
3. |
Expand Microsoft. |
|
4. |
Right-click the TestSubkey key, and then click Rename. |
|
5. |
Type Test, and then press ENTER. |
Deleting a key or value
To delete the TestDWORD DWORD Value in the TestSubkey subkey, follow
these steps:
|
1. |
Expand HKEY_LOCAL_MACHINE. |
|
2. |
Expand SOFTWARE. |
|
3. |
Expand Microsoft. |
|
4. |
Click the TestSubkey subkey. |
|
5. |
Right-click the TestDWORD DWORD Value, and then click Delete. |
|
6. |
Click Yes to confirm that you want to delete the value. |
For more information about editing the registry, follow these steps in Registry Editor:
|
1. |
On the Help menu, click Help Topics. |
|
2. |
On the Contents tab, double-click Registry Editor. |
|
3. |
Double-click How To. |
|
4. |
Double-click Change Keys and Values, and then click the topic that you want. |
Microsoft
Management Console (MMC) hosts administrative tools that you can use to
administer networks, computers, services, and other system components. The
Group Policy MMC snap-in allows administrators to define policy settings that
are applied to computers or users. You can implement Group Policy on local
computers by using the local Group Policy MMC snap-in, Gpedit.msc. You can
implement Group Policy in Active Directory by using the Active Directory
Users and Computers MMC snap-in. For additional information about using Group
Policy, see the Help topics in the appropriate Group Policy MMC snap-in.
back
to the top
Use a Registration Entries (.reg) file
Create a Registration Entries (.reg) file that contains the registry changes, and then run the .reg file on the computer where you want to make the changes. You can run the .reg file manually or by using a logon script. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
310516 How to add, modify, or delete registry subkeys and values by using a Registration Entries (.reg) file
The Windows Scripting Host lets you run VBScript and JScript scripts directly in the operating system. You can create VBScript and JScript files that use Windows Scripting Host methods to delete, to read, and to write registry keys and values. For additional information about these methods, visit the following Microsoft Web sites:
RegDelete
method
http://msdn.microsoft.com/library/en-us/script56/html/wsMthRegDelete.asp
RegRead method
http://msdn.microsoft.com/library/en-us/script56/html/wsMthRegRead.asp
RegWrite method
http://msdn.microsoft.com/library/en-us/script56/html/wsMthRegWrite.asp
Use Windows Management Instrumentation
Windows
Management Instrumentation (WMI) is a component of the Microsoft Windows
operating system and is the Microsoft implementation of Web-Based Enterprise Management (WBEM). WBEM is an industry initiative to develop a standard
technology for accessing management information in an enterprise environment.
You can use WMI to automate administrative tasks (such as editing the
registry) in an enterprise environment. You can use WMI in scripting
languages that have an engine on Windows and that handle Microsoft ActiveX
objects. You can also use the WMI Command-Line utility (Wmic.exe) to modify
the Windows registry.
For additional information about WMI, visit the following Microsoft Web site:
For additional information about the Wmic.exe, click the following article number to view the article in the Microsoft Knowledge Base:
290216 A description of the Windows Management Instrumentation command-line utility
Use Console Registry Tool for Windows
You can
use the Console Registry Tool for Windows (Reg.exe) to edit the registry. For
help with the Reg.exe tool, type reg /? at the Command Prompt, and
then click OK.
back
to the top
To restore the registry, use the appropriate method.
To
restore registry subkeys that you exported, double-click the Registration
Entries (.reg) file that you saved in the Export registry subkeys section. Alternatively, you can
restore the whole registry from a backup. For additional information about
how to restore the whole registry, see the Restore the whole registry section.
back
to the top
To restore the whole registry, restore the system state from a backup. For additional information about how to restore the system state from a backup, click the following article number to view the article in the Microsoft Knowledge Base:
309340 How to use Backup to restore files and folders on your computer in Windows XP
Note Backing up the system state also creates updated copies of the registry files in the %SystemRoot%\Repair folder. If you cannot start Windows XP after you edit the registry, you can replace the registry files manually by using the steps in the "Part One" section of the following Microsoft Knowledge Base article:
307545 How to recover from a corrupted registry that prevents Windows XP from starting
314837 How to manage remote access to the registry
310595 Description of HKEY_CURRENT_USER registry subkeys
310593 Description of the RunOnceEx registry key
307545 How to recover from a corrupted registry that prevents Windows XP from starting
286422 How to back up and restore a Windows Server 2003 cluster
104169 Files that are automatically skipped by the backup program (NTBackup.exe) during the backup and restore processes
310426 How to use the Windows XP and Windows Server 2003 Registry Editor features
APPLIES TO
|
• |
Microsoft Windows Server 2003, Datacenter Edition |
|
• |
Microsoft Windows Server 2003, Enterprise Edition for Itanium-based Systems |
|
• |
Microsoft Windows Server 2003, Datacenter Edition |
|
• |
Microsoft Windows Server 2003, Enterprise Edition |
|
• |
Microsoft Windows Server 2003, Standard Edition |
|
• |
Microsoft Windows Server 2003, Web Edition |
|
• |
Microsoft Windows Small Business Server 2003 Premium Edition |
|
• |
Microsoft Windows Small Business Server 2003 Standard Edition |
|
• |
Microsoft Windows XP Home Edition |
|
• |
Microsoft Windows XP Professional |
|
• |
Microsoft Windows XP Tablet PC Edition |
|
• |
Microsoft Windows XP Media Center Edition 2002 |
|
• |
Microsoft Windows XP Professional 64-Bit Edition (Itanium) |
|
• |
Microsoft Windows XP Professional 64-Bit Edition (Itanium) |