Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i retrieve subfolders in the registry?

Status
Not open for further replies.

Yale

Programmer
Sep 30, 2004
31
US
hello! i am trying to retrieve ALL the subfolders in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of the registry using the code below... for some reasons other subfolders are not listed/retrieved by the code... how can i resolve this?

here is my code --
<%@ Language=VBScript %>
<%
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Dim oReg, arrSubKeys, subKey, strDisplayName, strDisplayVersion, blnOffice2000, blnOffice2003, strOfficeV
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys

For Each subKey In arrSubKeys
Response.Write (subKey)& "<br>"
Next
%>

THANKS!
-Yale
 
Hello Yale,

>for some reasons other subfolders are not listed/retrieved by the code

What "other" subfolders? Do you mean the enumeration is not complete leaving some but not all subkeys unretrieved?

regards - tsuji
 
yes, some subkeys are not retrieved/listed in the result... any idea how to resolve this tsuji? anyone?

thanks,
yale :)
 
Yale,

Take a look of the return value.
[tt]
iret=oReg.EnumKey (HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys)
response.write iret & "<br>"
[/tt]
What is it?

- tsuji
 
tsuji... i got "0" as the return value...

-yale
 
Yale,

It then should be okay. You have to double check spelling or thing and also what seen in the registry under that key! Also checking these:
[tt]
response.write ubound(arrSubKeys) & "<br>"
response.write isarray(arrSubKeys) & "<br>"
[/tt]
But I won't expect much.
 
tsuji,

thanks for the quick replies...

response.write iret & "<br>" --> returns 0
response.write ubound(arrSubKeys) & "<br>" --> returns 86
response.write isarray(arrSubKeys) & "<br>" --> returns true
Response.Write (subKey)& "<br>" --> returns 86 values... but when i check my registry i have more than 140 subfolders/subkeys under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall...

here is the exact code that i am using:
<%@ Language=VBScript %>
<%
Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
Dim oReg, arrSubKeys, subKey, strDisplayName, strDisplayVersion, blnOffice2000, blnOffice2003, strOfficeV
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
".\root\default:StdRegProv")
oReg.EnumKey HKEY_LOCAL_MACHINE, UnInstPath, arrSubKeys

For Each subKey In arrSubKeys
Response.Write (subKey)& "<br>"
Next
%>

i don't see any wrong spelling... what else do u think could be wrong?

thanks for helping me on this!

-YALE
 
Yale,

With iret=0, there is nothing to do with the wmi part. My only opinion is to physical inspect the number of subkeys, in particular subkeys not retrieved. What kind of subkeys are they? I won't even bother to ask you choosing another key to enumerate, because it would certain go smoothly no problem. Other than these, I have no idea for the moment.

- tsuji
 
thanks for the help... i'll see what more i can do to resolve this...

regards,
yale
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top