Scheduled Computer Power Control question

Scheduled Computer Power Control question

I have created a job to shut down the computers in classrooms throughout my school at the end of each day. The problem I've noticed this morning is that all of the computers that were already turned off, are getting turned off when the machines are turned on in the morning. Is there a way to "skip" the machines that are already powered down when the daily job runs?

Work Around Solution

mabdelnabi's picture

One thing you can do for now is to send a Wake-on-LAN task to wakeup all the PCs and then apply the shutdown job. This not might be the best solution but it will buy you sometime till you find another solution.

we had the same issue

haim96's picture

and solved it by writing VBscript that check the time before it execute shutdown.
so if we set the schedule to run in 19:00
we set the VBscript to make sure it's 18:30 to 19:30
and if not the script abourt.

in the morning, when the task try to run on comuter that was already shutdown, the script abourt becuase the time check fail.

i will post the script as soon as i can...

The script

If you could post the script, that would be great!! Thanks for your help.

here it is

haim96's picture

i post is also as download but meanwhile:

' This script check the current hour to decide if the application should run or not.
' there is three modes for the script : Disable time check, same day check, and next day check.
' Writen by Dima and haim.

On error resume next
Err.Clear
dim objshell
dim startTime
dim endTime
dim useTime
dim nCurrHour
dim sameday

' Enable or Disable the time check.
' set 0 to disable time check
' set 1 to enable time check

useTime=1

' Set if the time check is for the same day.
' set this to 1 if the start and ent time are in the same day.
' set this to 0 if the end time is in the next day.

sameday=1 

' Set start time of the script.
startTime=21

' Set end time of the script.
endTime=5

nCurrHour=hour(now)
wscript.echo "Current Time: " & nCurrHour

if sameday = 0 then
    if ( useTime and not ((nCurrHour >= startTime and nCurrHour <= 24) or (nCurrHour >= 0 and nCurrHour < endTime ))) then 
      wscript.echo "should run in: " & startTime & " and " & endTime
      wscript.quit (-1)
  end if
else 
     if ( useTime and not ((nCurrHour >= startTime and nCurrHour <= endTime ))) then 
      wscript.echo "should run in: " & startTime & " and " & endTime
      wscript.quit (-1)
  end if
end if
 
set objshell = CreateObject("WScript.Shell")

 ' Insert here your Application to run
objshell.run "%windir%\notepad.exe" 

if Err.number<>0 then
  wscript.echo  "Error: " & Err.number & "," & Err.description
  wscript.quit Err.number
else
  wscript.echo  "DONE OK! "
  wscript.quit 0
end if

note that...

haim96's picture

note that i left the "Wscript.echo" lines
because you can use it in altiris to track errors.
just remember when you create the task to select under "Advenced" :

show script: hidden
[V] save script output with task status.

this alow you see all the computers that tried to
run the script in the morning.