Windows Task Scheduler: Kill Running Tasks

At work we have bunch of automated scripts running on one of the servers. Most are either batch scripts or PHP scripts that are triggered at various intervals sending out automatic email notifications, or some important business stats to the directors. Few people complained to me that they stopped receiving some of the emails sometime last week.

When I peeked at the Windows Task Scheduler on the server, I noticed that several of the tasks had their status listed as Running. This was obviously an issue, because most of these scripts only require fraction of a second to execute. Furthermore, right clicking affected items and choosing End Task produced absolutely no effect. Something went very wrong here.

I really did not want to reboot the whole machine for a stupid little issue like that so I started poking around trying to find the rogue processes. Unfortunately, the scripts themselves must have finished running long time ago and they did not appear in the task manager. It was not the scripts but the actual scheduler threads that launched them seem to have hung themselves.

Fortunately, I found out that restarting the task scheduler service did the trick. You can actually do this from the Scheduled Tasks window. Simply go to Advanced on your toolbar and choose Stop Using Task Scheduler. Then go back and click Start Using Task Scheduler again. If the window does not refresh automatically, just reload it manually. The status on the hung tasks should clear themselves.

I’m not sure what caused this to happen. I will keep my eye on the server to see if it does it again. It could be a number of things – for example the scripts themselves may be doing something strange. But on the other hand they were working for several weeks now without any issues, so go figure.

[tags]windows, windows task scheduler, task scheduler, scheduled tasks, running tasks, servicesp[/tags]

This entry was posted in sysadmin notes and tagged . Bookmark the permalink.



7 Responses to Windows Task Scheduler: Kill Running Tasks

  1. Roy Matter SWEDEN Internet Explorer Windows says:

    I recommend using VisualCron. With that automation tool you have perfect control of all running tasks that were started. Also it has some interesting functions like PGP/FTP/FTPS/SFTP.

    / Roy

    Reply  |  Quote
  2. Luke UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Thanks! It looks cool. I will definitely check it out.

    Reply  |  Quote
  3. Jeremy UNITED STATES Mozilla Firefox Windows says:

    Thanks for the article! I was looking for a solution to the exact same issue and this was it.

    Reply  |  Quote
  4. Eldho Thomas UNITED STATES Internet Explorer Windows says:

    Thanks !

    I had the same issue and stopping and starting the task scheduler (as you have mentioned) took care of it.

    I doubt it has anything to do with the script itself. I have about 10 of them running in Task Scheduler. They all hung. So, I think it is something to do with Task Scheduler itself.

    E~

    Reply  |  Quote
  5. saro UNITED KINGDOM Mozilla Firefox Windows says:

    Simple and brilliant article. Helped me straight away.

    Reply  |  Quote
  6. Mano UNITED STATES Internet Explorer Windows says:

    Thanks!!

    It worked for me.

    Reply  |  Quote
  7. Craig UNITED STATES Safari Mac OS says:

    Another thanks, had run into the same exact issue and fixed it right off with the help from this article.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>