Task Scheduler – Task Idle Conditions

scheduled-tasktask-schedulerwindows 10

Again me with the Task Scheduler.

Microsoft – Task Idle Conditions

Under Windows 7, tasks behave according to the rules stated in the link … tested and it works.

Under Windows 10 (Pro v1809 with all the updates) … well not exactly.

First of all both tasks (under Windows 7 and Windows 10) are the same.
The Task is created like this:

enter image description here
enter image description here
enter image description here
enter image description here
enter image description here

If I copy some files at 14:15, and move the mouse at 14:15, and type on my keyboard at 14:15 and then leaved my computer at 14:15, I would expect for the task to be executed at 15:15 and not at 14:30, or am I wrong?

The task always executes at 14:30 (if I leave my computer at max at 14:25) or it doesn't execute at all (for that day) if I'm working at my computer at 14:30. WTF? If I recreate the task at the computer with Windows 7, everything works just fine.

This was tested on 2 different computers with Windows 7 and 3 different computers with Windows 10. Numbers here doesn't matter, because the same thing happens at 02:00 with idle time of 15 minutes and wait time of 2 hours. They are here just to paint the picture what is happening.

I even thought this was connected somehow with the "working hours" in Windows 10 which is set between 06:00 and 00:00 so I moved the task at 14:30 … yeah, this didn't help.

And yes, I do understand that Windows 10 sees the idle time differently than Windows 7 but that would mean the task would be executed later not sooner and especially not at the time when the trigger was set.

Would be interested if someone could confirm this behavior and maybe provide some explanation why this is happening.


13.05.2019. – I can now definitely confirm this. Today two of my friends confirmed this issue. This has to be a bug in Windows 10 v1809 (maybe for earlier versions also but I don't have access to those). Also I can confirm that this works without the problem on Windows 7 machines. Great, just efing great. Will post this question on Microsoft forums.

enter image description here


15.05.2019. – Managed to test this on Windows 10 v1607 … same thing happens. How is it possible that no one has yet (in over two years) reported this issue to Microsoft? This can't be the way it's meant to behave, this is a clear bug in Windows 10.

Best Answer

Did you try using the On idle Trigger instead? As far as I know the task Idle conditions have been used for this trigger only.

On Idle Trigger

I have created a test task - it is below. It will be executed after 1 minute every time a computer became idle. To test it, I was just locking the Windows screen, using Win + L shortcut. The task has been executed exactly 1 minute after computer was locked.


Test Task.xml:

You can import this task into a task scheduler and test.

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2019-05-12T18:21:43.6698729</Date>
    <Author>nsm</Author>
    <URI>\Test Task</URI>
  </RegistrationInfo>
  <Triggers>
    <IdleTrigger>
      <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>
      <Enabled>true</Enabled>
    </IdleTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-18</UserId>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <AllowHardTerminate>true</AllowHardTerminate>
    <StartWhenAvailable>false</StartWhenAvailable>
    <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
    <IdleSettings>
      <Duration>PT1M</Duration>
      <WaitTimeout>PT1H</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>true</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\Projects\StackOverflow\cmd\testidletask.cmd</Command>
    </Exec>
  </Actions>
</Task>

testidletask.cmd:

@echo off
for /f "tokens=*" %%i in ('date /T') do set DATE=%%i
for /f "tokens=*" %%a in ('time /T') do set TIME=%%a
echo %DATE% %TIME% >>C:\Projects\StackOverflow\cmd\testidletask.log