Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript reads a blank REG_SZ value

Status
Not open for further replies.

JustScriptIt

Technical User
Oct 28, 2011
73
US
Hello,

I've been researching a way to read the value of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Symantec\Symantec Endpoint Protection\SMC


Where the value I want to read is ProductVersion

So far, I am trying it on my own computer where I can SEE that the value exists, yet it is coming as blank.

Can you see the code I have so far and tell me what I am missing:

Code:
Option Explicit

Dim strComputer, strKeyPath, strValueName, oReg, strValue

const HKEY_LOCAL_MACHINE = &H80000001
strComputer = "."
Set oReg=GetObject( _
   "winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Symantec\Symantec Endpoint Protection\SMC"
strValueName = "ProductVersion"
oReg.GetStringValue _
  HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "Current SEP Version: " & strValue
 
&H80000001 is not the local machine hive, it is the current user hive.

hkey_local_machine = &H80000002

-Geates



"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top