What happens to my enumkey

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to print a registry key but it doens't work as expected. How can i fix
this problem.?

thanks

'==========================
Const HKEY_LOCAL_MACHINE = &H80000002

spath="SOFTWARE\Microsoft\Windows\CurrentVersion\Setup"
showMe(spath)

'===================create function=============

Function showMe(Key)

aName="Installed"

Set oLoc = CreateObject("WbemScripting.SWbemLocator")
Set oSvc = oLoc.ConnectServer(null, "root/default")
Set oReg = oSvc.Get("StdRegProv")

Set oMethod = oReg.Methods_.Item("Enumkey")
Set oInParam = oMethod.InParameters.SpawnInstance_()
oInParam.hDefKey = HKEY_LOCAL_MACHINE
oInParam.sSubKeyName = Key
Set oOutParam = oReg.ExecMethod_(oMethod.Name, oInParam)

aNames = oOutParam.sNames

On Error Resume Next

For i = LBound(aNames) To UBound(aNames)
lrc= oReg.GetStringValue (HKEY_LOCAL_MACHINE, Key, aName, sValue)

If(lrc=0) Then
wscript.echo("Key: "&aNames(i)) ' doesn't work as expected
wscript.echo( aName &" : "& sValue)
wscript.echo("======================")
End If
showMe(Key&"\"&aNames(i))

Next

End Function
 
What are you trying to accomplish in the script?

You are enumerating the keys under spath, however, you then want to get the
value for the keys? Are you trying to get the information of the values in
hte Keys?
 
Back
Top