Registry Branch Level Reader

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Registry Branch Level Reader

Post by Bob Hansen » Sun Jan 25, 2009 4:44 am

It would be good to be able to read the list of Keys that are available. The existing RegistryReadKey actually returns the value of the Key. But many times it would be good to have a listing of the Key Names under a particular branch. Just asking for the next level beneath any stopping point on the branches. If last part of the branch is the final Key, then the result provides the names of the Key Values.

For example, look at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers and I can get a complete list of the Printers on my system. Just below that is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. I can get that list and cycle through the users on the system. From that I can get a list of all valid usernames, By reading HKEY_CURRENT_USER\Software\MJTNET I can get a listing of three programs installed from MJT.

These examples may not have any real value at this point, but when I don't know the name of the Key, or how many there are, then I cannot use RegistryReadKey to retrieve the Key Values that I need.

A similar variation would be a list of the Value Names for any Key. Again, if you don't know the name, or the spelling, etc. you cannot read the values, or you may write values with wrong spellings. Would also be good to have a count of the items returned. Could use ";" as a delimiter in the result because registry uses comma for \ character.

Suggested syntax:
RegistryNextLevel>root_key,branch,result_variable

Examples:
RegistryNextLevel>HKEY_CURRENT_USER,Software\MJTNET,vResult

vResult would show: ClipMagic;MSched;MSched11
result_count would also show a value of 3.
----------------------
RegistryNextLevel>HKEY_CURRENT_USER,Software\MJTNET\MSched11,vResult

vResult would show: (Default);CloseButtonMinimizes;CodeFolding;Col0; .....TrayReminder;Width
result_count would have a value of 50
----------------------
RegistryNextLevel>HKEY_LOCAL_MACHINE,SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers,vResult

vResult would show: ,,98_ME,870 CSE_ME;;;98_ME,HP2610;Generic / Text Only;Intuit Internal Printer;.......PDF995;QuickBooks PDF Converter
result_count would have a value of 19

This tool would allow me to actually reproduce the entire structure of a branch without knowing any of the names, just the name of the first level branch. From that I could run the command, parse out what I need, run the command again for the next level, repeating as needed.

Someone else will probably want to explode the tree from the branch end vs. just the next level. That could probably be added as another command parameter: RegistryNextLevel>root_key,branch,result_variable[,All] with the default of Next vs. All

Thanks for listening.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts