Hi all
I have a little problem with this script... it should work like this:
1. Check the time (script should only work between 10PM-11PM)
2. Check online status
3. Shutdown computers which are online
4. list all online(and offline) computers
the timecheck itself works... but i dont know how to stop the script when it shows the "wrong" time...
the online check works without problems (shutdown should work too... didnt checked this till now)
Next problem is, that i have to check perhaps 100 different IP's... it works like i did it here, but it looks bad...
ah, and this is my first script... and the first thing i ever did with kix
... so i am happy for every assistance i get
code:
$TimeofDay = Val( SubStr(@TIME,1,2) )
Select
Case $Timeofday => 6 AND $Timeofday < 22
$timetorun = "error"
$m=MessageBox ("Wrong Time",Time)
Case $Timeofday >= 22 AND $Timeofday <= 23
$timetorun = "ok"
$m=MessageBox ("Time OK",Time)
Case 1
$timetorun = "error"
$m=MessageBox ("Wrong Time2",Time)
EndSelect
$Counter=0
$IP="149.250.16.207"
;If $timetorun="error"
; $Counter="3"
; Else
; $Counter="0"
;EndIf
Do
Shell '%comspec% /c ping -w 1 $IP|find "Timeout" > nul'
If @error
Shell "%comspec% /e:1024 /c echo $IP Online >> c:\temp\kix\ping.txt"
; Shutdown ("\\$IP","Shutdown in 30 Seconds",30,1,2)
Else
Shell "%comspec% /e:1024 /c echo $IP Offline >> c:\temp\kix\ping.txt"
EndIf
$Counter=$Counter+1
If $Counter=0
$IP="149.250.16.207"
EndIf
If $Counter=1
$IP="149.250.16.208"
EndIf
If $Counter=2
$IP="149.250.16.55"
EndIf
Until $Counter=3
Shell "%comspec% /e:1024 /c echo @day @time >> c:\temp\kix\ping.txt"