Hi all

I'm making a logoff script to clear my history. Before i start i want to see
the registry values that are there, so i write this little code snippet:

set shell = CreateObject("WScript.Shell")

WScript.Echo shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\TypedURLs")


but i keep getting an error!

Error: Unable to open registry key "the key above" for reading
Code: 80070002
Source WshShell.RegRead

But with a reg query "HKEY_CURRENT_USER\Software\Microsoft\Internet
Explorer\TypedURLs" /s
reads the registry without any trouble...

Any suggestions?

Thanks for your time

Remi

Re: Unable to read registry values by Michael

Michael
Tue May 25 21:16:30 CDT 2004

> I'm making a logoff script to clear my history. Before i start i want
> to see the registry values that are there, so i write this little
> code snippet:
>
> set shell = CreateObject("WScript.Shell")
>
> WScript.Echo
> shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet
> Explorer\TypedURLs")
>
>
> but i keep getting an error!
>
> Error: Unable to open registry key "the key above" for reading
> Code: 80070002
> Source WshShell.RegRead
>
> But with a reg query "HKEY_CURRENT_USER\Software\Microsoft\Internet
> Explorer\TypedURLs" /s
> reads the registry without any trouble...
>


RegRead on a key that has no default vaule set will throw that error...

If you want to enumerate the named values of of a key, RegRead is the wrong
tool to use. Use WMI's StdRegProv and EnumValues...


From: "Michael Harris \(MVP\)" <mikhar at mvps dot org>
Subject: Re: Please help: Getting REGISTRY info w/ StdRegProv
Date: Wed, 19 May 2004 19:39:28 -0700
Message-ID: <uXSu1OhPEHA.620@TK2MSFTNGP10.phx.gbl>
Newsgroups: microsoft.public.scripting.vbscript

http://groups.google.com/groups?selm=uXSu1OhPEHA.620%40TK2MSFTNGP10.phx.gbl&output=gplain

--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US


Re: Unable to read registry values by Remi

Remi
Wed May 26 07:52:24 CDT 2004

Now I've tried this snippet:

On Error Resume Next

const HKEY_CURRENT_USER = &H80000001
strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Internet Explorer\TypedURLs"
oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys

For Each subkey In arrSubKeys
WScript.Echo subkey
Next

but it still turns up empty
there are 25 typed URLs as subkeys in there...

can anyone tell me what Im missing?

Thanks
Remi
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:OYx3xdsQEHA.2452@TK2MSFTNGP11.phx.gbl...
> > I'm making a logoff script to clear my history. Before i start i want
> > to see the registry values that are there, so i write this little
> > code snippet:
> >
> > set shell = CreateObject("WScript.Shell")
> >
> > WScript.Echo
> > shell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet
> > Explorer\TypedURLs")
> >
> >
> > but i keep getting an error!
> >
> > Error: Unable to open registry key "the key above" for reading
> > Code: 80070002
> > Source WshShell.RegRead
> >
> > But with a reg query "HKEY_CURRENT_USER\Software\Microsoft\Internet
> > Explorer\TypedURLs" /s
> > reads the registry without any trouble...
> >
>
>
> RegRead on a key that has no default vaule set will throw that error...
>
> If you want to enumerate the named values of of a key, RegRead is the
wrong
> tool to use. Use WMI's StdRegProv and EnumValues...
>
>
> From: "Michael Harris \(MVP\)" <mikhar at mvps dot org>
> Subject: Re: Please help: Getting REGISTRY info w/ StdRegProv
> Date: Wed, 19 May 2004 19:39:28 -0700
> Message-ID: <uXSu1OhPEHA.620@TK2MSFTNGP10.phx.gbl>
> Newsgroups: microsoft.public.scripting.vbscript
>
>
http://groups.google.com/groups?selm=uXSu1OhPEHA.620%40TK2MSFTNGP10.phx.gbl&output=gplain
>
> --
> Michael Harris
> Microsoft.MVP.Scripting
> Sammamish WA US
>



Re: Unable to read registry values by y

y
Wed May 26 08:11:52 CDT 2004

"Remi Lillelien" <remi_strikethis_@eunet.no> wrote in message news:eTQdQByQEHA.1620@TK2MSFTNGP12.phx.gbl...
> Now I've tried this snippet:
>
> On Error Resume Next
>
> const HKEY_CURRENT_USER = &H80000001
> strComputer = "."
>
> Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
> strComputer & "\root\default:StdRegProv")
>
> strKeyPath = "Software\Microsoft\Internet Explorer\TypedURLs"
> oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys
>
> For Each subkey In arrSubKeys
> WScript.Echo subkey
> Next
>
> but it still turns up empty
> there are 25 typed URLs as subkeys in there...
>
> can anyone tell me what Im missing?
>
You must use EnumValues and GetStringValue method. Try this.

const HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Internet Explorer\TypedURLs"
oReg.EnumValues HKEY_CURRENT_USER, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
oReg.GetStringValue HKEY_CURRENT_USER, strKeyPath, subkey,wValue
wscript.echo subkey
wscript.echo wValue
Next