Link to home
Start Free TrialLog in
Avatar of hpops
hpops

asked on

Query registry key and output results to a log file

This should be an easy one but I'm having trouble with it.

This script is working for me, however I need to have a log file generated on the value it finds in the registry. The value is a "Mutli-string" key.

I have a way to run this at login and would like the script to append the results it finds to a network server. I'd also prefer it create the log file if it did not exist otherwise append to it.

Thanks for any help with this one

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
 
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SYSTEM\Setup"
strValueName = "OEMDuplicatorString"
oReg.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,arrValues
 
For Each strValue In arrValues
    StdOut.WriteLine  strValue
Next

ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hpops
hpops

ASKER

Thank you very much. I have combined these two sections together and it's working great. I appreciate your fast response and am increasing the points for this question.
Thanks!