Priority in Windows Task Scheduler

Anyone who runs jobs in the Windows Task Scheduler will sooner or later encounter inexplicable runtime differences. A PHP script that runs in 5 minutes on the command line suddenly takes 20 minutes when executed via the Windows Task Scheduler. Same user, same permissions, same code – four times the execution time. What was going on?


After hours of debugging, Process Monitor sessions, and countless configuration comparisons, the solution was frighteningly simple: Windows Task Scheduler sets a lower process priority by default. The default value for tasks in Task Scheduler is 7 (Below Normal), not 4-6 (Normal) as expected. This seemingly small difference can lead to massive performance degradation in I/O-intensive operations.

The Windows priority levels in detail are:

ValuePriorityDescription
0RealtimeHighest priority (caution!)
1HighHigh priority
2-3Above NormalAbout Normal
4-6NormalStandard for interactive processes
7Below NormalDEFAULT in Task Scheduler
8-9Below NormalEven lower
10IdleLowest priority

The problem with priority in task scheduling is multi-layered: When you export a task and look at the XML, you will often no Priority setting. Windows will then silently use the default value 7. The GUI displays this value during export, but it is not explicitly stored in the task. The lower priority not only results in less CPU time, but also:

  • Throttled disk I/O operations
  • Lower network priority
  • Poor file system caching
  • Delays in database access

Even if you use the same user and enable "Run with highest privileges," the task runs in a different Windows station/desktop environment with different priorities. To identify the problem, you can use PowerShell to list all tasks with their actual priorities.:

38b7fa6c77dc344401485cd338ea4128

Almost all my tasks ran with priority 7. We now specifically correct the priority of several tasks at once:

38b7fa6c77dc344401485cd338ea4128

After setting the priority to 4 (Normally) my PHP script ran again in the expected 300 seconds. If you have configured tasks with a specific user account, you can also easily specify this in line 10 as follows.:

38b7fa6c77dc344401485cd338ea4128

Back