short thoughts‎ > ‎

Manage Windows 2003 and 2008 Scheduled Tasks with Chef

posted May 21, 2012, 7:51 PM by Steve Craig
So, I'm a fan of Opscode and Chef, as you may have gathered from my previous posts: I wrote a cookbook to install magiciso, I wrote up how I manage Microsoft SQL Server Backups, why I went with Chef instead of puppet, and did a quick summary on how to setup your MacOSX workstation to manage Windows Chef nodes.

My third release is Kronos, a cookbook to manage Microsoft Windows 2003 and 2008 Server Scheduled Tasks with Chef.  The overall design is simple, and locates most settings inside databags.  Kronos supports both Task Scheduler version 1 and 2.

Windows 2003 / Task Scheduler v1 integration is simple and straightforward: chef deletes all scheduled tasks each run, and then recreates them all from databag settings.  This has two main limitations: first, task history is deleted along with the settings; and second, no "unmanaged" tasks are permitted, as they will be purged at the beginning of each chef run.  Clearly this is suboptimal.  Kronos for Windows 2003 does, however, support nearly every Task Scheduler v1 setting option.

Windows 2008 / Task Scheduler v2 integration is a little more advanced, and handles both these cases.  Kronos for Windows 2008 permits the existence of "unmanaged" tasks, and only ensures that each managed task is deleted and recreated on each run.  Task settings are stored in the registry, so Kronos for Windows 2008 is a bit more complicated to support that aspect.  Kronos for Windows 2008 does not support all the available Task Scheduler v2 settings yet. has been running kronos in production now for about a year and have run into no major issues.  It has proven to be a reliable and straightforward method of ensuring tasks are appropriately scheduled.