Break on
;Try to open list with computer names
If Open(3, "\\server\kix2010.460\Allpc.txt", 2) = 0
;List successfully opened. Do more stuff.
;Read first line from the list.
$computer = ReadLine(3)
;If no error occurred and the line is not empty more stuff.
;Enter a loop until the line from the file is empty or end of file is reached.
While @ERROR = 0 AND Trim($computer) <> ""
;Read sysroot from the registry.
$sysroot = ReadValue("\\" + $computer + "\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "PathName")
;Split sysroot on : and join it with $.
;This just replaces c: with c$.
$sysroot = Join(Split($sysroot, ":"), "$")
? "Deleting Temp Files From " + $computer
;Set variable Y
$Y = "\\" + $computer + "\" + $sysroot + "\Installer\*.msp"
;Show $y on the screen.
?$y
;Delete stuff from the remote machine.
Del "\\" + $computer + "\" + $sysroot + "\Installer\*.msp" /c /h /s
;Read the next line from the list.
$computer = ReadLine(3)
Loop
;Close the list with computer names.
Close (3)
;Show message and error codes if opening the list failed.
Else
?"Unable to open list of computer names."
?"Error number: " @ERROR
?"Error text: " @SERROR
Sleep 5
EndIf