You probably need to remove the trailing slash. If you use that, if will look for the default value for the key you have specified, and if it does not find it, will give that error.
Conversely, if you try to access a key as if it was a value by using no trailing slash, you will get the same error.
Some examples trying to access a key:
Fails:
var keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion";
var shell = new ActiveXObject("WScript.Shell");
var regValue = shell.RegRead(keyPath);
WScript.Echo("Value: " + regValue);
Succeeds (but gives empty result since Default value is empty):
var keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\";
var shell = new ActiveXObject("WScript.Shell");
var regValue = shell.RegRead(keyPath);
WScript.Echo("Value: " + regValue);
Some examples trying to access a value:
Succeeds (output is Value: C:\Program Files
):
var keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir";
var shell = new ActiveXObject("WScript.Shell");
var regValue = shell.RegRead(keyPath);
WScript.Echo("Value: " + regValue);
Fails (shouldn't use trailing slash when accessing a value):
var keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir\\";
var shell = new ActiveXObject("WScript.Shell");
var regValue = shell.RegRead(keyPath);
WScript.Echo("Value: " + regValue);