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.
Answers (3)
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
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.