2
0
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)
here is the same screenshot after I click on Change settings that are currently unavailable
:
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 – 2014-05-05T13:54:23.543
Following on from @Kayasax's q, does the script have some UI interaction that won't work when the workstation is asleep ? – None – 2014-05-05T14:50:05.583
no UI interaction at all – malat – 2014-05-06T06:56:44.773
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 – 2014-05-06T12:55:56.057