You can merge these hives by loading them into a temporary key in the registry itself and copying one hive over the other using the
Considering the nature of the question, please note that I am not liable for any damages that may arise as a result of the use of this answer. For more information, see the Stack Exchange Network Terms of Service.
I actually tested these commands myself on a Windows 7 machine using dummy data, without changing any existing data in the registry, so they should work. I am making the assumption that the registry hive files are supplied to you; if they aren’t, you’ll probably need to obtain them by booting into a Linux live CD and retrieving the files from computers’ hard drives. I couldn’t export them on a live system through
reg save on an elevated command prompt, getting little more than
Access is denied errors.
If the hives are supplied as more than one file per computer, and they need to be operated upon as a single unit, you’ll need to load and merge them in the registry using the same techniques discussed henceforth, on the keys corresponding to the computer from which the hive files are derived, before copying computer B’s complete hives onto computer A’s. Otherwise, you can merge each hive individually using the following procedure.
Assume that hive HA is stored in file
Ha.hivand hive HB is stored in file
Hb.hiv. Begin by creating a key
HKLMTempusing Registry Editor, then load HA and HB into this temporary key on either computer using these commands in an elevated command prompt:
reg load HKLMTempHa Ha.hiv reg load HKLMTempHb Hb.hiv
Copy the contents of HB into HA, overwriting any existing keys and values:
reg copy HKLMTempHb HKLMTempHa /s /f
Unload the registry hive files using Registry Editor by selecting the
Hakey, choosing Unload Hive under the File menu, and repeating the same for
Hb. You can then delete the temporary key
reg unloadwon’t work; I tried it myself and got
Access is denied, but I was able to do it through Registry Editor.)
The merged hive HA‘ is now stored in
For more information on the
reg command, see http://technet.microsoft.com/en-us/library/cc732643.aspx.
Registry operations are actually part of at least the base Windows libraries, if not the NT kernel itself.
The only official method of merging keys into hives on a binary level lies there. Microsoft to my knowledge has not released to the public how this works. Any such documentation I believe is the result of reverse engineering.
And it’s really stupid to rely on the binary level format of the registry to accomplish something that can be done without knowing the implementation details, since Microsoft may amend or completely change the format at any time, since it has exclusive control of the format.
There is probably many third party tools that manipulate the registry. I would not rely on them except in a desperate situation (i.e. changing local Admin password if you have no other recourse to get into a system), experimentation, or if you know your software is 100% tied to a specific Windows version – simply because of the fact you do not know what Microsoft will do with the proprietary format in the future. Microsoft provides the implementation-agnostic registry APIs for a reason.