I am trying to create a script to read a txt file with workstation names and then read a value in HKLM. I have it partially working but I can't get it to read the registry information. I have a standalone VBS to query and echo out the values but I am having an issue with the whole process of reading the text file then querying the workstation.
I am looking for help in trying to get the reg query correct.
VBScript Code
Double-click the code block to select all.On Error Resume Next Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 const HKEY_LOCAL_MACHINE = &H80000002 Set StdOut = WScript.StdOut Dim strComputer Dim strKeyPath Dim strValueName set strValueName="Shell" set strKeyPath="SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objUserFile = objFSO.OpenTextFile("C:\rcj\scripts\regquery\ws.txt", 1) Do While objUserFile.AtEndOfStream <> True strComputer = objUserFile.ReadLine strComputer = Trim(strComputer) Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") 'oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue Set colFiles = oReg.GetStringValue (HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue) For Each objFile in colFiles WScript.Echo "Current Shell Value: " & vbTab & strComputer & vbTab & strValue wscript.echo & vbTab & strComputer wscript.echo & vbTab & strValue Next Loop objUserFile.Close Function WMIDateStringToDate(dtmDate) WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2)) End Function