This project has moved and is read-only. For the latest updates, please go here.

Creating Tasks per a User Defined Calendar

Sep 10, 2012 at 5:00 PM

I have used the Task Scheduler Managed Wrapper to schedule tasks successfully, but now I need to have my daily tasks not run on select days of the year such as holidays.  Is there a way to leverage this need with the Wrapper without having to delete already scheduled daily tasks just prior to the holiday and re-add them after?

Sep 11, 2012 at 12:14 AM

There is no "exception" trigger function that will prohibit execution of a scheduled task. Two thoughts on how to do this more manually:

  1. Instead of scheduling using a single DailyTrigger, you could use 12 separate MonthlyTrigger for each month and then specify the days that year that are not known holidays. You would need to update the trigger list each year though and make sure to set an expiration date for each trigger for the end of year.
  2. Have a script that will go out just before each holiday and set the task's Enabled property to false and then set it back to true at the end of the holiday.

I wish I had a better answer.




Sep 11, 2012 at 2:06 PM

Thank you dahall. I considered that approach as well.

I have decided to approach this problem from the opposite angle. I am going to add the “exception” logic to my Agent application. The Agent will still be launched daily, but will shut itself down on holiday runs after writing a “shutdown reason” to log. I feel this approach will be much less code intensive and easier to maintain. I’m “kinda” surprised that MS didn’t think of this scenario when they were writing the Task Scheduler.

I need to provide my user with a GUI anyway allowing them to specify which days of the year are exceptions. So it should work out well.

Thanks again for responding.