/build/static/layout/Breadcrumb_cap_w.png

VBScript Help

Hi,
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"

Else
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

Regards
Jimmy

0 Comments   [ + ] Show comments

Answers (2)

Posted by: anonymous_9363 15 years ago
Red Belt
0
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.
Posted by: jimmyx 15 years ago
Purple Belt
0
Thanks as always for your help Ian, those scripts will come in very useful

Regards
Jimmy
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ