Break on
;open file to create bat file
OPEN(1,"\\server\KiX2010.460\dosdel.bat",5)
;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
;Write Delete stuff from the remote machine to batch file.
WRITELINE (1, "Del \\" + $computer + "\" + $sysroot + "\Installer\*.msp /f /q" + @CRLF)
;print error record
?@error
?@serror?
;Read the next line from the list.
$computer = ReadLine(3)
Loop
;Close the list with computer names and batch file.
Close (3)
CLOSE (1)
EndIf