Windows scheduled tasks get problematic slower over time

  • 29 April 2021
  • 1 comment
  • 145 views

Userlevel 7
Badge +13

The following post is not directly related to backup. I hope it is helpful anyway.

At a customers backup server a very strange behavior was observed. After a few days without problems, scheduled tasks never seem to get finished. So a current running – never ending – task prevents the next run from starting. A reboot of the server resolved the problem – for a few days.

Solution

After a research I found out, scheduled tasks get started with a lower priority than interactively started tasks. See my scheduled PowerShell script in screenshot here.

Normally this is not a big deal. It does not matter when tasks like reports last longer than manually started. Nevertheless they should at least finish.

The solution is to rise the priority of scheduled tasks. Unfortunately this cannot simply be set in the GUI. It can be done in a few steps, I list here.

  1. Start Windows Task Scheduler, right-click your task and select Export… and save XML file to a temporary location.
  2. Edit XML file with an editor of your choice. Search for <Priority>7</Priority> and replace digit 7 by 4. Save file again. This sets tasks priority to the priority interactive tasks gets. This includes memory priority as well.
  3. Create a new task by importing edited XML file. To do so, click Action and Import Task … in Task Scheduler.
  4. After you selected your XML file, Create Task windows appears. All settings of your task respectively your XML file are already set. If you did not delete your old task, you need to change Name of the new task. Otherwise press OK.

A running scheduled task should now show Normal priority in Task Manager. It should also finish within normal timeframe continuously.


1 comment

Userlevel 7
Badge +17

Good topic 👍

I have puzzled on this priority thing quite a while, too. But have not found the trick with the XML export/import.

Thanks for this hint. 😎

Comment