I have a strange problem looking up registry keys using VB.

Heres some sample code basically its checking that HKCU\ Exists

Set objShell = CreateObject("Wscript.Shell")

NoConfig = objshell.RegRead("HKCU\")

If Err.Number = 0 Then
WScript.echo "Configuration Exists"

WScript.echo "Configuration does not exist"

End If

Can anyone shed any light on why it might work on some machines (works on my development PC and on another couple of users machines), but on other systems I always get "the unable to open registry key "HKCU\" for reading" error message. Any advice on where to start troubleshooting would be much appreciated

0 Comments   [ + ] Show Comments


Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.


Jimmy, get hold of the registry class from JSWare.net. I think it's called 'cRegistry'. It has a raft of features which, even if you don't use them know, you certainly will in the future. One of those features is KeyExist (or KeyExists - I use a version which I've tailored and can't remember the original name). Don't be put off by the fact that it's got a scary "class" name. It's easy to use and the file has examples to follow. There's an INI class there, too.
Answered 05/07/2009 by: VBScab
Red Belt

Please log in to comment
Thanks as always for your help Ian, those scripts will come in very useful

Answered 05/12/2009 by: jimmyx
Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity