Break on
; Declare variables to prevent scope creep
Dim $InFile, $OutFile ; file names for input and output
Dim $Computer ; computer name, from input file
Dim $Rc ; return-code catcher
Dim $Version ; Version data from Computer
$Rc = SetOption('NoVarsInStings', 'On')
$OutFile = ('c:\test\version.txt')
$InFile = ('C:\test\ie8.txt')
; Open the input file - no strings in quotes!
If Open( 1 , $InFile) <> 0
'Failed to open ' $InFile ' - aborting!' ?
Exit 1
EndIf
; same for the output file
If Open( 2 , $OutFile, 5) <> 0
'Failed to open ' $OutFile ' - aborting!' ?
Exit 1
EndIf
; Read the first line, then loop until EOD (End Of Data) error
$Computer = ReadLine(1)
While Not @ERROR
'Computer: ' $Computer ? ; display the current computer
; Only read the registry if the computer is online
If Ping($Computer)
$Version = Readvalue('\\' + $Computer + '\HKLM\SOFTWARE\Microsoft\Internet Explorer', 'Version')
Else
$Version = 'PC Not Online' ; no ping response
EndIf
; If the registry data is blank, provide appropriate message
$Version = IIf($Version, $Version, 'Invalid data from PC')
'Version: ' $Version ? Display version
$Rc = WriteLine(2, $Version + ' ' + $Computer + @CRLF)
$Computer = ReadLine(1)
Loop
$Rc = Close(1)
$Rc = Close(2)