Alan Abreu Absent Member.
Absent Member.
175 views

Getting Registry Value

Jump to solution
I copied this right out of the Help and modified the path but it doesn't work:

Set WshShell = WScript.CreateObject("WScript.Shell")
RL_Key = WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Run\RoboticLink Service Controller\")
WScript.Echo WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Run\RoboticLink Service Controller\")

I get an "Object Required 'WScript'" msg (see attached)

Any idea why?
0 Likes
1 Solution
7 Replies
Cody Marcel Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
WScript object does not exist until yo udefine it. Try this...


Set WshShell = CreateObject("WScript.Shell")
RL_Key = WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Run\RoboticLink Service Controller\")
WScript.Echo WshShell.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Run\RoboticLink Service Controller\")


0 Likes
Henry Floyd Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
Are you running this out of QTP?

if you are running this out of QTP you should get a dialog box with the key value

Set WshShell = CreateObject("WScript.Shell")
RL_Key = WshShell.RegRead("HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\RoboticLink Service Controller")
msgbox RL_Key
0 Likes
Cody Marcel Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
His error message told me he was running it inside QTP. You are correct in that the help was intended to be run from an external VBScript.
0 Likes
Alan Abreu Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
Thanks.

That seems better but still not totally working. I'm actually trying to verify that a String does or does not exist in the Registry. Is there a better way to do that?
0 Likes
Henry Floyd Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
I can not think of a better way then using the regedit to look at the key at least to verify it by hand.
0 Likes
Highlighted
Alan Abreu Absent Member.
Absent Member.

Re: Getting Registry Value

Jump to solution
Thanks for the help everyone
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.