break on
? "Please input the Computer name to connect to. "
Gets $remote_pc
if @inwin=2 exit endif
Do $tempfile = "timestamp.txt"
$source = "c:\source\*.*"
;'disconect j:\ and map j:\ to to remote pc's C$
$drive = "\\" + $remote_pc + "\c$"
use j: /delete
use j: $drive
if @error = 0
beep
? "Connected to Remote computer Successful."
else
? "Cannot connect to the share "
Goto getpc
endif
;'copy source of the program instal to remote C:\instaldir (including instal.bat) -----
;'You can leave the source also on a win95 share, but not on a NT share
;'that's because te remote NT scedule service runs under system acount
;'This acount can not logon to NT shares.
;'At least instal.bat should stand on c:\instaldir
;'Instal.bat (YOUR UNATENDED instal file) should install the program !
;'This script let the remote machine acount run instal.bat instead of the user
;'As users cann't install apps on NT, and users are potential security risks.
if exist("j:\instaldir\*.*")
else
md "j:\instaldir\"
endif
if exist("J:\instaldir\zcheck.txt")
else
? "Copying Files"
copy "$source" "j:\instaldir\"
endif
? "Finished Copying Files"
;' start the schedule service remotely ----------------
;' this part is later because need to give service time to enable itself
$runner = "SC.EXE \\" + $remote_PC + " start Schedule"
run $runner
sleep 10
? "Schedule is started."
;'retrieve remote time by reading remote file creation time stamp
;'That's a importend one of the clevar idea's behind it
;'Because my problem was always time differences between target and remote machines
;'now this works against the remote time
;'The function is a bit complex as remote time could be in different formats
;'And Also because of a bug in IExplorer 5.x need at least to schedule remote over 15 minutes
:gotime
$filetime = @TIME
$MINUUT = Val(substr($filetime,4,2))
$UUR = Val(substr($filetime,1,2))
if $Minuut > 44
$Uur = $Uur + 1
$Minuut = $Minuut - 45
else
$Minuut = $Minuut + 15
endif
? $minuut
? $Uur
$FILETIME = "$UUR:$MINUUT:00"
; $Filetime = "10:45:00"
$Command = "AT \\" + $remote_pc + " "
? $Filetime
shell $command + $FILETIME + " c:\instaldir\setup.exe -s"
; run $command + $FILETIME + " %windir%\zawsys\wkix32.exe %windir%\zawsys\rv-logon.kix"
?
? "Setup is scheduled"
?
sleep 5
;' Remove the temporaly mapped drive from this machine
use j: /delete
; Get another computer name
:getpc
? "Type exit to quit"
? "Please input the Computer name to connect to. "
flushkb
Gets $remote_pc
Until $remote_pc = "exit"
exit