I use a path to locate pieces of information that contains a guid that can change. I had the guid value hard coded, but when it changes it doesn't function. I need to discover that guid dynamically. I know a value on the other side of the guid and have a REG Query that finds the entire path, but I can't figure out how to capture that path.
Here's the REG Query:
REG Query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products /D /V /F "Microsoft Office Professional Plus 2010" /S /E
It returns the Value "DisplayName" and it's contents "Microsoft Office Professional Plus"
When run from a batch file it also displays the entire path that includes the elusive guid. I would like to do this from a vb script.
Also the newer Windows Scripting Host Shell object also makes registry access easy.
See https://msdn.microsoft.com/en-us/library/293bt9hh(v=vs.84).aspx
Also WMI can access registry. Unlike both above methods it can ennumerate, so you can see what is there without having to know in advance.
https://msdn.microsoft.com/en-us/library/aa390387(v=vs.85).aspx
It can also check security and monitor changes to keys.
This monitors changes to Windows Uninstall key.
https://msdn.microsoft.com/en-us/library/aa393041(v=vs.85).aspx
Recursion is used to walk each node in a tree. The function calls itself every time it comes across a node. Start below program using cscript to avoid a few thousand msgboxs -
cscript //nologo c:\folder\RecurseReg.vbs
.Putting both together (this does VC 2008 Runtime which should be on all computers)
For V6 or VBA
The registry is simple in VBA. It's is very limited and uses ini file concepts. There's a few of them such as (from Object Browser [F2] in VBA editor)
Also the Windows API calls can be used.
RegOpenKeyEx
The RegOpenKeyEx function opens the specified registry key.