Hi guys

Wondering if any body can help. I'm trying to find a vbs script that can compare HKCU keys and automatically move them into the HKLM if they are the same.

We used to use a macro that did this with our old copy of Wise. I know that all HKCU keys are not the same but what i'm trying to do is write a script that i can excute to compare what keys repackaged (if any) are writing to the HKCU hive, to minimize the work of manually checking each key individually.

We don't do any user based installations for Windows 7 x64 packaging so ideally we would like to run something like this to stream line our process and put any duplicate keys into the HKLM hive.

0 Comments   [ - ] Hide Comments


Please log in to comment

Community Chosen Answer



If they are same then why do you want to move them again to HKLM.. You can just delete the HKCU entries if they are already present in HKLM..

You can write a VBScript using Windows Installer object..

Algorithm like

Select 'Key', 'Name', 'Value' from Registry WHERE 'Root'="1"

Select 'Key', 'Name', 'Value' from Registry WHERE 'Root'="2"

Compare them... If they are same then remove the row WHERE 'Root'="1"

You can put this in loop...



Answered 08/02/2012 by: jagadeish
Red Belt

  • Make sure that after removing the HKCU entry from Registry table, there is no empty component in the component table..
Please log in to comment
Answer this question or Comment on this question for clarity



Do you need to scan the whole HKCU hive or some specific keys only?

Also you can try using tools like Picture Taker to check whether the package is writing to HKCU hive.

Answered 08/01/2012 by: SilentKiller
Orange Belt

Please log in to comment

Agreed, I setup VM workstations and run a baseline scan with a package creator program like rapid install or WISE studio. Then I install the application and close the scan so it displays all the changes made to my system between the install process.


Just remember some things like Anti-Virus might be running so verify what you're seeing in the registry. But it gives you a good idea what all changes were made.

And if you want just these tools allow you to remove most of any parts of the install to make your own custom package that just add those Keys you want to deploy, if needed.


hope this helps.

Answered 08/01/2012 by: AgentMrQ
Senior White Belt

Please log in to comment
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja