/build/static/layout/Breadcrumb_cap_w.png

Win7 RegRead works sometimes --Aargh!

I am trying to read a registry key value on Win7 64bit system and one time it will work and the next it won't. Driving me mad!

The key exists and has a value. The permissions say it should be readable.
About as simple a read as you can do in a vb script

Dim thing
thing = "HKEY_LOCAL_MACHINE\SOFTWARE\Intel\WirelessCommon\AppFramework\Settings\PROSetVersion"
sRegVer = oShell.RegRead(thing)
WScript.Echo sRegVer

Error is "Invalid Root in Registry Key"
which is usually a permissions thing provided your reg path and key are correct.
I have tested this on multiple systems with the same result.

if it never worked, then I know it is my fault, but if it sometimes works?!

Anybody run into intermittent read problems like this?

0 Comments   [ + ] Show comments

Answers (3)

Posted by: anonymous_9363 14 years ago
Red Belt
0
ProcMon will show you what's going on. It will display a NAME NOT FOUND or ACCESS DENIED error at the first key that RegRead fails on.
Posted by: Lucid 14 years ago
Purple Belt
0
Try this:
Option Explicit
Dim oShell, thing, sRegVer
Set oShell = WScript.CreateObject("WScript.Shell")
thing = "HKEY_LOCAL_MACHINE\SOFTWARE\Intel\WirelessCommon\AppFramework\Settings\PROSetVersion"
sRegVer = oShell.RegRead(thing)
WScript.Echo sRegVer

If that doesn't work, you might try VBScab's method, or else look into using the StdRegProv Class: http://msdn.microsoft.com/en-us/library/aa393664(VS.85).aspx
Posted by: anonymous_9363 14 years ago
Red Belt
0
I don't think that a missing Shell object is the problem. If it was, the RegRead would fail with an 'Object required' error.
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