Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Managing Windows Server 2012 Systems : Managing the Registry (part 5) - Registry administration - Importing and exporting registry data

- How To Install Windows Server 2012 On VirtualBox
- How To Bypass Torrent Connection Blocking By Your ISP
- How To Install Actual Facebook App On Kindle Fire
12/17/2014 3:30:06 AM

Modifying the registry of a remote machine

You can modify the registry of remote computers without having to log on locally. To do this, select Connect Network Registry on the File menu in Registry Editor, and then use the Select Computer dialog box to specify the computer with which you want to work. In most cases, all you must do is type the name of the remote computer and then tap or click OK. If prompted, you might need to enter the user name and password of a user account that is authorized to access the remote computer.

After you connect, you get a new icon for the remote computer under your Computer icon in the left pane of Registry Editor. Double-tap or double-click this icon to access the physical root keys on the remote computer (HKEY_LOCAL_MACHINE and HKEY_USERS). The logical root keys aren’t available because they are either dynamically created or simply pointers to subsets of information from within HKEY_LOCAL_MACHINE and HKEY_USERS. You can then edit the computer’s registry as necessary. When you are done, you can select Disconnect Network Registry on the File menu and then choose the computer from which you want to disconnect. Registry Editor then closes the registry on the remote computer and breaks the connection.

If you’re wondering why you would do this, the primary reason is to work with a specific hive, such as the hive that points to Dianne Prescott’s user profile because she inadvertently changed the display mode to an invalid setting and can no longer access the computer locally. With her user-profile data loaded, you could then edit the registry to correct the problem and then save the changes so that she can once again log on to the system.

 Managing the registry using preferences

Rather than managing the registry on individual computers, you can use Group Policy preference items to configure the registry on any computer that processes a particular Group Policy Object (GPO). As when you configure the registry manually, you can use Group Policy preferences to create, modify, and delete registry keys and their values. Group Policy then writes the registry preferences during its normal refresh cycle and in this way, your registry preferences are deployed automatically.

Importing and exporting registry data

Sometimes you might find that it is necessary or useful to copy all or part of the registry to a file. For example, if you’ve installed a service or component that requires extensive configuration, you might want to use it on another computer without having to go through the whole configuration process again. So, instead, you could install the service or component baseline on the new computer, export the application’s registry settings from the previous computer, copy them over to the other computer, and then import the registry settings so that the service or component is properly configured. Of course, this technique works only if the complete configuration of the service or component is stored in the registry, but you can probably see how useful being able to import and export registry data can be.

By using Registry Editor, it is easy to import and export registry data. This includes the entire registry, branches of data stemming from a particular root key, and individual subkeys and the values they contain. When you export data, you create a .reg file that contains the designated registry data. This registry file is a script that can then be loaded back into the registry of this or any other computer by importing it.

Note

Because the registry script is written as standard text, you can view it and, if necessary, modify it in any standard text editor as well. Be aware, however, that double-tapping or double-clicking the .reg file starts Registry Editor, which prompts you as to whether you want to import the data into the registry. If you are concerned about this, save the data to a file with the .hiv extension because double-tapping or double-clicking files with this extension won’t start Registry Editor. Files with the .hiv extension must be manually imported (or you could simply change the file extension to .reg when it is time to use the data).

To export registry data, press and hold or right-click the branch or key you want to export and then select Export. You can also press and hold or right-click the root node for the computer you are working with, such as Computer for a local computer, to export the entire registry. Either way, you’ll see the Export Registry File dialog box as shown in Figure 9. Use the Save In selection list to choose a save location for the .reg file, and then type a file name. The Export Range panel shows you the selected branch within the registry that will be exported. You can change this as necessary or select All to export the entire registry. Then tap or click Save to create the .reg file.

Exporting registry data to a .reg file so that it can be saved and, if necessary, imported on this or another computer.
Figure 9. Exporting registry data to a .reg file so that it can be saved and, if necessary, imported on this or another computer.

Want to export the entire registry quickly?

You can export the entire registry at the command line by typing regedit /e SaveFile, where SaveFile is the complete file path to the location where you want to save the copy of the registry. For example, if you want to save a copy of the registry to C:\Corpsvr06-regdata.reg, you type regedit /e C:\corpsvr06-regdata.reg.

You can also extend this technique to rapidly determine the exact registry values the operating system modifies when you make a change to a system or application setting. Start by opening the application of the System utility you want to work with as well as a command prompt window. Next, export the registry prior to making the change you want to track. Then immediately and without doing anything else, make the change you want to track and export the registry to a different file using the command-prompt window you opened previously. Finally, use the file comparison tool (fc.exe) to compare the two files. For example, if you saved the original registry to orig.reg and then changed registry to new.reg, you could type the following command at a command prompt to write the changes to a file called changes.txt: fc /u orig.reg new.reg > changes.txt. When you examine the changes.txt file in a text editor, you’ll see a comparison of the registry files and the exact differences between the files.

Importing registry data adds the contents of the registry script file to the registry of the computer you are working with, either creating new keys and values if they don’t already exist or overwriting keys and values if they do exist. You can import registry data in one of two ways. You can double-tap or double-click the .reg file, which starts Registry Editor and prompts you as to whether you want to import the data. Or you can select Import on the File menu, and then use the Import Registry File dialog box to select and open the registry data file you want to import.

Using export or import processes to distribute registry changes

The export and import processes provide a convenient way to distribute registry changes to users. You could, for example, export a subkey with an important configuration change and then mail the associated .reg file to users so that they could import it simply by double-tapping or double-clicking it. Alternatively, you could copy the .reg file to a network share where users could access and load it. Either way, you have a quick and easy way to distribute registry changes. Officially, however, distributing registry changes in this manner is frowned upon because of the potential security problems associated with doing so.

Loading and unloading hive files

Just as you sometimes must import or export registry data, you’ll sometimes need to work with individual hive files. The most common reason for doing this, as discussed previously, is when you must modify a user’s profile to correct an issue that prevents the user from accessing or using a system. Here, you would load the user’s Ntuser.dat file into Registry Editor and then make the necessary changes. Another reason for doing this is to change a particular part of the registry on a remote system. For example, if you need to repair an area of the registry, you could load the related hive file into the registry of another machine and then repair the problem on the remote machine.

Loading and unloading hives affects only HKEY_LOCAL_MACHINE and HKEY_USERS, and you can perform these actions only when you select one of these root keys. Rather than replacing the selected root key, the hive you are loading then becomes a subkey of that root key. HKEY_LOCAL_MACHINE and HKEY_USERS are, of course, used to build all the logical root keys used on a system, so you could work with any area of the registry.

After you select either HKEY_LOCAL_MACHINE or HKEY_USERS in Registry Editor, you can load a hive for the current machine or another machine by selecting Load Hive on the File menu. Registry Editor then prompts you for the location and name of the previously saved hive file. Select the file, and then tap or click Open. Afterward, enter a name for the key under which you want the hive to reside while it is loaded into the current system’s registry, and then tap or click OK.

Note

You can’t work with hive files that are already being used by the operating system or another process. You could, however, make a copy of the hive and then work with it. At the command line, type reg save followed by the abbreviated name of the root key to save and the file name to use for the hive file. For example, you could type reg save hkcu c:\curr-hkcu.hiv to save HKEY_LOCAL_MACHINE to a file called Curr-hkcu.hiv on drive C. Although you can save the logical root keys (HKCC, HKCR, HKCU) in this manner, you can save only subkeys of HKLM and HKU using this technique.

When you are finished working with a hive, you should unload it to clear it out of memory. Unloading the hive doesn’t save the changes you’ve made—as with any modifications to the registry, your changes are applied automatically without the need to save them. To unload a hive, select it and choose Unload Hive on the File menu. When prompted to confirm, tap or click Yes.

Working with the registry from the command line

If you want to work with the registry from the command line, you can do so using the REG command. REG is run using the permissions of the current user and can be used to access the registry on both local and remote systems. As with Registry Editor, you can work only with HKEY_LOCAL_MACHINE and HKEY_USERS on remote computers. These keys are, of course, used to build all the logical root keys used on a system, so you can work with any area of the registry on a remote computer.

REG has different subcommands for performing various registry tasks. These commands include the following:

  • REG ADD Adds a new subkey or value entry to the registry.

  • REG COMPARE Compares registry subkeys or value entries.

  • REG COPY Copies a registry entry to a specified key path on a local or remote system.

  • REG DELETE Deletes a subkey or value entry from the registry.

  • REG EXPORT Exports registry data and writes it to a file.

    Note

    These files have the same format as files you export from Registry Editor. Typically, however, they are saved with the .hiv extension, so double-tapping or double-clicking files with this extension won’t start Registry Editor.

  • REG FLAGS Sets or queries the flags on a registry key. Flags that can be associated with keys include DONT_VIRTUALIZE, DONT_SILENT_FAIL, and RECURSE_FLAG.

  • REG IMPORT Imports registry data, and either creates new keys and value entries or overwrites existing keys and value entries.

  • REG LOAD Loads a registry hive file.

  • REG QUERY Lists the value entries under a key and the names of subkeys (if any).

  • REG RESTORE Writes saved subkeys and entries back to the registry.

  • REG SAVE Saves a copy of specified subkeys and value entries to a file.

  • REG UNLOAD Unloads a registry hive file.

You can learn the syntax for using each of these commands by typing reg followed by the name of the subcommand you want to learn about and then /?. For example, if you want to learn more about REG ADD, you type reg add /? at the command line.

Other -----------------
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 11)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 10)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 9)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 8)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 7)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 6)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 5)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 4)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 3)
- Understanding Network Services and Active Directory Domain Controller Placement for Exchange Server 2013 (part 2)
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us
Popular tags
Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 windows Phone 7 windows Phone 8
programming4us programming4us
 
programming4us
Natural Miscarriage
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Game Trailer