/build/static/layout/Breadcrumb_cap_w.png

VBS script to move registry keys

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   [ + ] Show comments

Answers (3)

Posted by: jagadeish 12 years ago
Red Belt
2

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...

 

 


Comments:
  • Make sure that after removing the HKCU entry from Registry table, there is no empty component in the component table.. - jagadeish 12 years ago
Posted by: SilentKiller 12 years ago
Orange Belt
1

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.

Posted by: AgentMrQ 12 years ago
Senior White Belt
1

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.

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ