VbScript - Using Reg Query to find a value associated with a key
Posted on 2006-11-01
I am using the reg query command line within a vbscript to return a specific value associated with a key. The problem I am having is that the command ignores the portion where I specify the value to query. Instead the key with all of it's values are returned (output dumped into a text file). I have tried using the regread and enumkey methods to return the information I need, but both fail. Here's the part of the script I am using to do this;
strTextFile = "compliance.txt"
strKeyPath = "HKLM\SOFTWARE\Network Associates\ePolicy Orchestrator\Application Plugins\VIRUSCAN8000"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%COMSPEC% /c reg.exe QUERY " _
& Chr(34) & strKeyPath & Chr(34) & "/V DATVersion >>" & strTextFile, 0, True
Any assistance would be much appreciated. Thank you.