ModemJunki Posted August 29, 2013 Share Posted August 29, 2013 (edited) Never mind - my source text list was "dirty" - machine names had spaces after them from a typo in a DOS batch FOR command - it seems to be working now. My bad. Suggestions for improvement or alternatives are always welcome. I'm not sure whats going on here - I have a list of machine names, I read it with AutoIt and then do a remote reg read. Some machines don't allow me to read the registry key - I get errorlevel 3 from RegRead - but the same machine I can run the DOS command "reg query" against the same key and it works. I'm stumped. expandcollapse popup;~ #RequireAdmin #include <File.au3> If $cmdline[0] = 0 Then MsgBox(1, "Error: Command line required", "Missing command line parameter!" & @CR & @CR & _ "You must pass a file name with .txt extension to this tool" & @CR & @CR & _ "Or you can pass a single machine name to this tool" & @CR & @CR & _ "Message timeout in 5 seconds", 5) Exit Else $sCommandLine = $cmdline[1] $ChkInput = StringRight($sCommandLine, 4) If $ChkInput = ".txt" Then $InFile = $sCommandLine $VerOut = FileOpen(@ScriptDir & "\Project_version_list_.txt", 1) FileOpen($InFile, 0) For $i = 1 To _FileCountLines($InFile) $line = FileReadLine($InFile, $i) ClipPut($line) Exit $CheckIfOnline = Ping($line) Sleep(500) If $CheckIfOnline > 0 Then Sleep(1000) Local $locver = RegRead("\\" & $line & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\66FC3C3413AAD6740B92D672E4648FC6\00002109B30000000000000000F01FEC\", "ComponentVersion") Select Case @error = 3 FileWriteLine($VerOut, "Unable to open registry remotely on machine " & $line & "- check permissions.") Case @error = 2 FileWriteLine($VerOut, "No Project version key found on machine " & $line) Case @error = 1 FileWriteLine($VerOut, "No Project version found on machine " & $line) Case Else FileWriteLine($VerOut, "-> Found Project version " & $locver & " on machine " & $line) EndSelect Sleep(500) Else FileWriteLine($VerOut, "Unable to reach (ping) machine " & $line) EndIf sleep(1000) Next FileClose($InFile) FileClose($VerOut) Else $CheckIfOnline = Ping($sCommandLine) If $CheckIfOnline > 0 Then Local $locver = RegRead("\\" & $sCommandLine & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\66FC3C3413AAD6740B92D672E4648FC6\00002109B30000000000000000F01FEC\", "ComponentVersion") Select Case @error = 3 MsgBox(48, "Error", "Unable to open registry remotely on machine " & $sCommandLine & "- check permissions.") Case @error = 2 MsgBox(48, "Error", "No Project version key found on machine " & $sCommandLine) Case @error = 1 MsgBox(48, "Error", "No Project version found on machine " & $sCommandLine) Case Else MsgBox(0, "Success", "-> Found Project version " & $locver & " on machine " & $sCommandLine) EndSelect Sleep(500) Else MsgBox(48, "Error", "Unable to reach (ping) machine " & $sCommandLine) EndIf EndIf EndIf Edited August 29, 2013 by ModemJunki Always carry a towel. Link to comment Share on other sites More sharing options...
rudi Posted September 4, 2013 Share Posted September 4, 2013 Hi. you might want to edit your topic: 76 people were reading your self solved issue so far without need! Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now