3

In my windows 10 machine I have created the below task scheduler task and set the trigger time to be 1 min when idle. I've checked and manually timed the trigger to happens and it always triggers after 4 mins when no keyboard or mouse actions, not 1 min. I've manually timed it more than 5 times and it always runs after 4 mins not 1 min. Any explanation? and how I can run it after 1 min of idle time not 4 mins? Also the same task doesn't trigger at all on windows 7 as described here https://superuser.com/questions/1568707/task-scheduler-on-idle-task-not-triggered-windows-7

I've noticed on the Microsoft docs https://docs.microsoft.com/en-us/windows/win32/taskschd/task-idle-conditions that it says something about 4 minutes but I didn't understand and I don't know if it's related or not? and why it doesn't work at all on my windows 7 machine.

enter image description here

Below is how my scheduled task looks in task scheduler:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

Also here is the xml of my Task:

<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Date>2019-11-20T15:43:06.6081219</Date>
    <Author>MyPC\MyUser</Author>
    <URI>\MyAppIdleTask</URI>
  </RegistrationInfo>
  <Triggers>
    <IdleTrigger>
      <Enabled>true</Enabled>
    </IdleTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>S-1-5-21-1004336348-1177238915-682003330-385281</UserId>
      <LogonType>InteractiveToken</LogonType>
      <RunLevel>LeastPrivilege</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>PT0S</WaitTimeout>
      <StopOnIdleEnd>true</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <AllowStartOnDemand>true</AllowStartOnDemand>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>true</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
    <Priority>7</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>C:\MyWinFormApp\MyWinForm.exe</Command>
    </Exec>
  </Actions>
</Task>

1 Answer 1

2

Microsoft basically programmed Windows to say: A computer is considered Idle if for 4 minutes, no user input was generated.

What this means is this: Windows starts detecting that a system is idle but ignores it for 4 minutes. The exact reason why is unknown, but it is probably for optimization reasons and possible complaints. When the system becomes in Idle state after 4 minutes, the OS announces: the system is now idle for 4 minutes, and counting...

Task scheduler gets the message, sees your task which is set, idle for 1 minute and thinks: Oh, we should've started you 3 minutes ago. Lets start you now. In windows 7, it doesn't care for the 3 previous minutes.

This gives you 2 options.

  1. Accept that there always will be a delay of 4 minutes
  2. Don't use Task Scheduler. Instead create a program or script that measures activity and perform the launching of the task yourself. Do note that this will increase the overhead of the system and may hurt performance if coded inproperly.

My recommendation would be to go for option 1. Just accept that there is a 4 minute delay. Your initial question was 30 minutes anyway.

9
  • So you mean if on windows 7 I set the idle time to be 5 mins then it should work?
    – Tak
    Commented Jul 16, 2020 at 12:30
  • No, Windows 7 does not admire the 4 minute idle timer. Windows 7 checks if the system is idle every 15 minutes, and if during its check it determines its idle, your task should then run.
    – LPChip
    Commented Jul 16, 2020 at 12:54
  • So this means if I set the task idle time to be 20mins then it should trigger and work after 15 mins on windows 7, right?
    – Tak
    Commented Jul 16, 2020 at 12:56
  • It should, yes. 15 minutes would work too. Lets say, Windows 7 checks if your computer is idle, but you aren't. 10 minutes later, you become idle, the next idle schedule is in 5 minutes. 5 minutes later, windows knows you are idle, If your system is now idle for the next 10 minutes, your script will fire.
    – LPChip
    Commented Jul 16, 2020 at 13:01
  • I just tested it now on my windows 10 machine and set the idle time to 5 mins and I manually timed the idle time 3 times and it always triggered after 4 mins not 5 mins, any idea why? I will test it on my windows 7 machine but will probably take more time as I need to wait for 20 mins.
    – Tak
    Commented Jul 16, 2020 at 14:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .