2

I am trying to setup a daily task (running CTest from a batch script). I have used the default GUI of my Vista Pro 32bits, and setup the following task:

> schtasks /query /tn "trunk nightly" /xml
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2014-04-17T11:44:43.2643714</Date>
    <Author>PC-de-optiplex3\voxxl</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <StartBoundary>2014-04-17T05:00:00</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <RunLevel>HighestAvailable</RunLevel>
      <UserId>PC-de-optiplex3\voxxl</UserId>
      <LogonType>Password</LogonType>
    </Principal>
  </Principals>
  <Settings>
    <IdleSettings>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>true</WakeToRun>
    <ExecutionTimeLimit>P3D</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Dashboards\ctest_scripts\hpdesk_openjpeg.bat</Command>
      <WorkingDirectory>C:\Dashboards\ctest_scripts\</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

From the GUI, it tells me that the last run happened on the 24th, while today is the 28th, so clearly it runs properly for a couple of days and then stop. Is there a way to setup a daily windows tasks, that actually runs on daily basis ? My user has admin rights, has a password, and workstation is properly plugged (no power outage during the week end).

As can be seen from the XML output, the flag WakeToRun is properly set to true. From the power management system, I cannot however set the famous Allow wake timers (interface if in french but clearly the 4th parameters is missing, simply compare with this)

enter image description here

here is the same screenshot after I click on Change settings that are currently unavailable:

enter image description here

Clearly the code above does not make use of any UI at all at least it does not open anything when I right click 'execute' from the windows schedulers panel. It run smoothly when executed by hand.

It looks just as if a task cannot run when computer is asleep...

  • is it working when executed manualy (right click / start) ? can you test another time and see if it is OK when the computer is awake ? – Loïc MICHEL May 5 '14 at 13:54
  • Following on from @Kayasax's q, does the script have some UI interaction that won't work when the workstation is asleep ? – Angst May 5 '14 at 14:50
  • no UI interaction at all – malat May 6 '14 at 6:56
  • Set a start time for like 5 minutes from now then check your event logs. Could be a permissions issue for some reason or something else equally fun. Another thing I'd do to help troubleshoot: in the command that points to the script in schedtask add the line ">hpdesk_openjpeg_output.txt" to the end of that command. This would save the output to a text file as if you ran it straight from cmd - but using the scheduled task process which can sometimes cause fun behaviors you wouldn't catch otherwise. – Bradley Forney May 6 '14 at 12:55
1
+50

You have to enable wake up timers in the power savings plan options:
Control Panel -> Power Options -> Change plan settings -> Change advanced power settings.
In the list, item Sleep, change Allow wake timers to Enable.

The GUI parameters for the scheduled task should include :

In the General tab:

  • Check Run whether user is logged in or not

In the Conditions tab:

  • Check Wake the computer to run this task.

If there is no Wake the computer to run this task checkbox, then most probably your BIOS or hardware do not support wake timers, which is why Windows will not display the option.

If that's the case, the only other idea I have is, if wake-on-LAN is supported, to maybe do the waking from another computer on the network.

  • Here is the documentation for Vista: support.microsoft.com/kb/929463 I do not see anything like what you described from my vista environment. – malat May 7 '14 at 7:02
  • It would be easier to fire up the Task Scheduler and check. – harrymc May 7 '14 at 8:28
  • let me rephrase my intial comment into: after searching in my vista installation I do not see anything called "Allow wake timers". Furthermore I took an extra (afterward) step to check online if I could find it, and I found the above link to microsoft documention. – malat May 7 '14 at 11:00
  • I don't have Vista, but this link shows how to reach "Allow wake timers" on Vista, and it's effectively different from Windows 7. If this works for you, I'll add it in my answer. – harrymc May 7 '14 at 11:20
  • I've added a screenshot (sorry it's in French) of what parameters I can change. 'Allow wake timers' is not among them. – malat May 7 '14 at 12:18
0

If you're unable to get the task scheduler to work for you, and, your task is started from sleep or hibernation, have a look at WakeOnStandby. It's free and it just might provide what you're looking for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.