Setting a scheduled task process priority

I have been testing some long-running processes running over night, initiated from the Windows Server 2008 Task Scheduler. To my chagrin, they were still running when I checked them in the morning. I found out the default task priority for processes initiated from a scheduled task is “below normal”. To make matters worse for me, there is no way to override this from the Task Scheduler GUI. I have not confirmed it, but suspect this may all have been true in earlier Windows Server versions as well.

As usual, there is a way around this, but this time we don’t even have to alter the registry (no really!). In the Task Scheduler, right-click the task and select Export… and save the exported task in a file, then open that in a text editor (like Notepad). This is the XML that defines the task. Each action will have a <Task> section, which contains <Settings>, which contains a <Priority> element. The default value, for “below normal”, is 7. You can use either 6, 5, or 4 for “normal” priority. You will not usually want to go above “normal”. See http://msdn.microsoft.com/en-us/library/aa383512.aspx for more information on priorities. Quick answer: 6 will probably work for you.

Update the value to what you want for the priority and save the modified XML. Go back to the Task Scheduler Library and choose Action > Import Task… from the menu. Feed it your modified XML file and it will open the Create Task dialog, using the name of your XML file as the default task name. Note that you cannot have duplicate task names. There is no ‘task name’ element in the XML; you can only name it when you import it. If you want to replace an existing task, you will either have to delete the existing task before the import, or give the import a new name then delete the old task and rename the new task with the old name.

About these ads
This entry was posted in Microsoft Windows, Windows Server 2008. Bookmark the permalink.

16 Responses to Setting a scheduled task process priority

  1. Stewart says:

    Great tip! I just have one question… did increasing the priority get your jobs done in a more timely fashion?

  2. bdbits says:

    The jury is still out. I discovered this only this morning when viewing the below-normal priority via Task Manager. I wanted to see why it was below-normal and that led to what I posted. When I bumped it up to normal in Task Manager, I did immediately see it consuming more resources, but it could be co-incidence I suppose. I should be able to tell over the next couple of nights as this runs for several hours every night. This is on a test box as I don’t have this level of access to production. If it appears to have an effect, I will have this changed over there. My window to run the job is pretty tight and it would be nice to shave some runtime off.

  3. bdbits says:

    This looks very promising. Last night cut a couple of hours off the run time. I will continue monitoring for a few nights in case last night was some kind of a fluke.

  4. Spol says:

    Thanks for sharing this; had a hard time finding the solution for changing priority of scheduled tasks. Why o why is there not such a simple option for a task in Task Scheduler? *sigh* microsoft :-\

    I’d used your solution for fixing the slow response of a taskbar (not the superbar of windows, but Sony’s Vaio Gate v2.2) when a lot of CPU-intensive program(s) were running.

    Thanks!

  5. Tim Crall says:

    Thanks!! This tip totally worked for me. My robocopies had been taking 4 times longer to run via Task Scheduler, but now they are right back to where they were when manually launched. Odd that a setting which the GUI is able to export and import cannot be modified from within the GUI itself – hopefully they will fix that in a future version.

  6. Matt says:

    Great tip! I actually wanted to lower my priority (I went to 9 which is below normal but not idle). I had been trying to get “start /low /b” solutions to work, but for some reason task scheduler had a problem with that and although it looked ok, it didn’t run my script.

  7. Jared says:

    Thank you, that worked like a charm – I have automated backups that I don’t need hogging all my resources while I’m using the computer and this allowed me to set it to the lowest priority. Appreciate the tip.

  8. prateek says:

    Been looking for it for a long time…
    simple consice comoplete
    Thanks

  9. daniel says:

    Excellent! I had a spamassassin process which was sometimes failing to respond to the email server in time, and this helped.

  10. Arvy says:

    Thank you, good tip. I have a process that is more important than all others, including Windows components, and now I set it to high. Again, thank you.

  11. JayP says:

    This fixed my problem also. Thank you very much! An interesting note is that as far as WIndows 7 goes, this is only a problem with the 64 bit version. I had a task that ran fine on a 32 bit version of Win7 but acted as described on the 64 bit version.

  12. Doug says:

    Thanks, bdbits. I’ve been wrestling with this for a few days and yours is the first truly relevant post I found. Got the priority changed, problem solved.

  13. Good tip! I used this to boost up the itype tasks, and now my volume control is more responsive under heavy system load.

  14. Way cool! Some very valid points! I appreciate you writing this post and the
    rest of the website is very good.

  15. repel says:

    Fabulous information with thanks :)

  16. read says:

    It’s perfect time to make a few plans for the longer
    term and it’s time to be happy. I have read this publish and if I may I want
    to recommend you few attention-grabbing things or tips.
    Maybe you could write subsequent articles relating to this article.
    I want to read more things approximately it!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s