Thoughts from the EPS Windows Server Performance Team
Today we are looking at a couple of new changes/additions to the Task Scheduler service in Windows Vista and Server 2008. As an overview, the Task Scheduler service provides controlled, unattended management of task execution, launched either on a schedule or in response to events or system state changes. If you have worked with Task Scheduler in the past, then the updates/changes are fairly significant. So, with that said, let’s dive right in … starting with the User Interface:
As you see above, Task Scheduler has now been integrated into the MMC as a new snap-in. Say goodbye to the stand alone Scheduled Tasks window via Control Panel, and hello to your one stop shopping location for everything related to the Task Scheduler. Within this window, you are presented with the Task Status and Active Tasks' section. These sections allow you to quickly view the status of your tasks and which ones are currently active. There are quite a few changes, so to keep our post brief, we’re only going to cover Triggers and Conditions and Settings in this post – beginning with Triggers:
The ability to trigger a task based on any event captured in the event log is one of the most powerful new features of the Windows Vista / Server 2008 Task Scheduler. This new capability allows administrators to send an e-mail or launch a program automatically when a given event occurs. And it can be used to automatically notify a support professional when a critical event—for example, a potential hard drive failure—occurs on a client machine. It also enables more complex scenarios, such as chasing down an intermittent problem that tends to manifest overnight. Task Scheduler can be configured to notify an administrator by e-mail that a problem has occurred. An administrator can also use Task Scheduler to automatically launch a program to collect more data when the error occurs.
Setting up tasks to launch when events occur is easy with the new Task Scheduler Wizard in Windows Vista / Server 2008. An administrator can simply select the task in the Event Viewer to be used as a trigger and, with one click, launch the Task Scheduler Wizard to set up the task. The seamless integration between the Task Scheduler user interface and the Event Viewer allows an event-triggered task to be created with just five clicks. In addition to events, the Task Scheduler in Windows Vista / Server 2008 supports a number of other new types of triggers, including triggers that launch tasks at machine idle, startup, or logon. A number of additional triggers allow administrators to set up tasks to launch when the session state changes, including on Terminal Server connect and disconnect and workstation lock and unlock. Task Scheduler still allows tasks to be triggered based on time and date, and provides easy management of regularly scheduled tasks.
In the new Task Scheduler, triggers can be further customized to fine tune when tasks will launch and how often they will run. You can add a delay to a trigger, or set up a task to repeat at regular intervals after the trigger has occurred. Administrators can also set limits on tasks, indicating that the task must stop running after a given period of time. Activation and expiration dates can also be specified.
In addition to specifying Triggers, a number of conditions can be defined for each task. Conditions are used to restrict a task to run only if the machine is in a given state. For example, you can launch a program when an event occurs only if the network is available, launch an action at a specific time only if the machine is idle, or launch an action at logon only if the computer is not operating in battery mode. In Windows Vista / Server 2008, administrators can define conditions based on the idle state of the computer, the power source of the computer (AC versus batteries), network connectivity, and the power state of the computer ("ON" versus in a sleep state). Perhaps most importantly, a task can be configured to awaken the computer from hibernation or standby to run a task.
Administrators can use settings to instruct Task Scheduler what actions to take if a task fails to run correctly. In case the task fails, administrators can indicate how many times to retry it. If the computer is not powered on when a task is scheduled, an administrator can use settings to ensure that the task will run as soon as the machine is available. An administrator can also define a maximum execution time for a task, ensuring that the task will time out if it runs too long.
With that, it’s time to wrap up this post. In our next post we will cover Flexible Actions and Triggers, Security and Reliability.
- Blake Morrison
I just get started with Windows server 2008 and I am glad to know these improvements. In the past I wrote a program to monitor Event Log changes and email one the critical ones. I am happy to see this is now built-in. Thanks for the article. Hope to see more of similar articles.
One of the best features of Vista. :) I hope MS will also add something like Automator which OS X has. Based on PowerShell or VBscript perhaps? That would be a killer feature to buy Windows 7.
I am trying to run a batch process unattended when the machine is looged off. I set the scheduler to run whether logged in or not, and my user has local admin privileges.
The process executes cmd.exe, but does not execute the batch file. Any ideas?
email does not work
- it is a problem all over the web but not resolution posted yet
Set the task to run as Network Service. That should clear up the email issue. Your mail server also has to pass mail without a login.
What is the definition of idle?
is there a way to include the event particulars in the e-mail message? the ID, source, description, etc, etc... that would be infinitely more useful!!!! :)
ok so my task scheduler is set to the wrong setttings it is set to windows 2007 when it should be set to windows 2003.. an now i cant run any tasks.. and i get a task error message.. an i cant get to any settting options to set it back.. what to do?
using scheduler to run a batch does launch the batch, but cmd.exe does never close (and task keeps running) even though when executed manually cmd.exe is closing
on windows 2003 this works fine.
Has anybody a clue?
Nice notion, the task scheduler in Vista.
However, I'd sure like to know how to make it display a message after locking workstation but have that message appear on the logon screen - all it does is show it on the desktop after you unlock the thing.
I find it odd this task I made would display the message on the desktop AFTER unlocking the computer since there's a separate trigger for starting task "on unlock workstation". Seems to me the task displaying the message AFTER unlocking makes the "on unlock workstation" option a bit of a moot point.
If anyone's reading this from Microsoft, see if you can fix this somehow.
On Win2k8 status of the scheduled task doesn't refresh automaitcally. We need to manually refresh it.
Any info/fix about it?
On Windows 2008 R2 / Win7 the Onetime trigger in RacTask is disabled by default. I am trying to use a PowerShell script to enabled this trigger. The script runs without errors but it doesn't the trigger is still disabled. The script works well if I enable/disable the task itself.
Can anyone help?