Hi,

I have been struggling with the following

I am using vbscript in an application that will display registry keys
(and their values) as part of a treeview control.

I know the 'parent key', under which there can be a varying number of
subkeys, and their subkeys, and so on.

I know how to enumerate subkeys under a single key, using WMI and
EnumKey

What I am srtuggling with is, that I need some mechanism to process
each of the found subkeys to find about their subkeys, and so on. Some
kind of recursive algorhythm. I have seen and tried examples of
recursive algorhythms, for instance for files and folders. But
somehow, I cannot get my brain to figure out how to translate those to
my needs.

I was hoping someone could help me out, either with some sample code
or a website perhaps? I have so far searched pscode.com and some
others, but havent quite found what I am looking for.

kind regards,
arno

Re: registry keys to treeview control by Michael

Michael
Thu Jun 14 15:50:00 CDT 2007

> I know how to enumerate subkeys under a single key, using WMI and
> EnumKey
>
> What I am srtuggling with is, that I need some mechanism to process
> each of the found subkeys to find about their subkeys, and so on. Some
> kind of recursive algorhythm. I have seen and tried examples of
> recursive algorhythms, for instance for files and folders. But
> somehow, I cannot get my brain to figure out how to translate those to
> my needs.
>

These threads should give you enough to go on...

stdregprov enumkey recursive group:*.scripting - Google Groups
http://groups.google.com/groups?q=stdregprov%20enumkey%20recursive%20group:*.scripting&hl=en&lr=lang_en&num=100&scoring=d


--
Michael Harris
Microsoft.MVP.Scripting



Re: registry keys to treeview control by arno

arno
Thu Jun 14 17:20:30 CDT 2007

Some of that looks promising, some tweaking needed but as far as I can
gather from it now it will do the trick. tx!

arno

Re: registry keys to treeview control by Mark

Mark
Thu Jun 14 18:25:38 CDT 2007

On Thu, 14 Jun 2007 22:16:19 +0200, arno wrote:

> Hi,
>
> I have been struggling with the following
>
> I am using vbscript in an application that will display registry keys
> (and their values) as part of a treeview control.
>
> I know the 'parent key', under which there can be a varying number of
> subkeys, and their subkeys, and so on.
>
> I know how to enumerate subkeys under a single key, using WMI and
> EnumKey
>
> What I am srtuggling with is, that I need some mechanism to process
> each of the found subkeys to find about their subkeys, and so on. Some
> kind of recursive algorhythm. I have seen and tried examples of
> recursive algorhythms, for instance for files and folders. But
> somehow, I cannot get my brain to figure out how to translate those to
> my needs.
>
> I was hoping someone could help me out, either with some sample code
> or a website perhaps? I have so far searched pscode.com and some
> others, but havent quite found what I am looking for.
>

Arno,

this script will sniff for subkey collections and form the new-found key
name on the fly.

http://www.tlviewer.org/EnumTypeLib.vbs.txt

--
Mark

Re: registry keys to treeview control by Paul

Paul
Thu Jun 14 19:19:06 CDT 2007


"Mark Pryor" <tlviewer@VISTAyahoo.com> wrote in message
news:4671ce72$0$8055$4c368faf@roadrunner.com...
> On Thu, 14 Jun 2007 22:16:19 +0200, arno wrote:
>
>> Hi,
>>
>> I have been struggling with the following
>>
>> I am using vbscript in an application that will display registry keys
>> (and their values) as part of a treeview control.
>>
>> I know the 'parent key', under which there can be a varying number of
>> subkeys, and their subkeys, and so on.
>>
>> I know how to enumerate subkeys under a single key, using WMI and
>> EnumKey
>>
>> What I am srtuggling with is, that I need some mechanism to process
>> each of the found subkeys to find about their subkeys, and so on. Some
>> kind of recursive algorhythm. I have seen and tried examples of
>> recursive algorhythms, for instance for files and folders. But
>> somehow, I cannot get my brain to figure out how to translate those to
>> my needs.
>>
>> I was hoping someone could help me out, either with some sample code
>> or a website perhaps? I have so far searched pscode.com and some
>> others, but havent quite found what I am looking for.
>>
>
> Arno,
>
> this script will sniff for subkey collections and form the new-found key
> name on the fly.
>
> http://www.tlviewer.org/EnumTypeLib.vbs.txt
>
> --
> Mark

Hi, Mark
I'm trying to use your script and having problems at about line 61, which
starts with:
if ubound(subkeys2)> 2 then wscript.echo

subkeys2 is sometimes not an array, so I get an error.
I've inserted the following lines ahead of that line:

If Not IsArray(subkeys2) Then
MsgBox "Subkeys2 is not an array for" & vbCrLf & _
Hex(hkey) & ", "& key & "\" & EnumKey(i) & "\" & subkeys1(j)
End If

I get this:
Subkeys2 is not an array for
80000000, TypeLib\{0002E157-0000-0000-C000-000000000046}\5.3

With RegEdit, I see that subkey 5.3 has no subkeys, but that most others
have at least a flags and helpdir subkeys.

Any ideas on how to fix the problem?

-Paul Randall

Is this just an oddball



Re: registry keys to treeview control by arno

arno
Fri Jun 15 16:10:39 CDT 2007

Mark,

Thanx, got it now. Only to find out that it is too slow to actually
work for me, but it is a start.

arno

Re: registry keys to treeview control by Mark

Mark
Fri Jun 15 23:01:42 CDT 2007

On Fri, 15 Jun 2007 23:10:39 +0200, arno wrote:

> Mark,
>
> Thanx, got it now. Only to find out that it is too slow to actually
> work for me, but it is a start.
>

Arno,

No doubt WMI is slow. Run the companion EnumTL.py script (D/L from same
URL) and see how much faster is ActivePython for the exact same task.

If you are stuck using WMI then ...
if you are sure that the RegKeys you are parsing don't change more
than daily, its best to do the Registry scraping separate from the ASP
script and cache the results to the server as a text file. Then the ASP
script can grab the results without any WMI load.

If you are going to do a lot of API type work from script and you have
control of the Server then start using ActivePython's WinAPI modules.

I have lots of Python samples somewhere. A huge part of the Win32 API can
be accessed from script this way.

I hate to pitch ActivePython in a VBScript group -- isn't it true that
XBOX is using Python?

--
Mark

Re: registry keys to treeview control by arno

arno
Mon Jun 18 08:38:47 CDT 2007

Mark,

tx for the ideas, however I am restricted to VBSript and it's not
running from an ASP page. It will have to do for now.

arno

On 16 Jun 2007 04:01:42 GMT, Mark Pryor <tlviewer@yahoo.com> wrote:

>No doubt WMI is slow. Run the companion EnumTL.py script (D/L from same
>URL) and see how much faster is ActivePython for the exact same task.
>
>If you are stuck using WMI then ...
>if you are sure that the RegKeys you are parsing don't change more
>than daily, its best to do the Registry scraping separate from the ASP
>script and cache the results to the server as a text file. Then the ASP
>script can grab the results without any WMI load.