Logo
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
World Cup news
 
 
Windows Server

Windows Server 2008 R2 :Task Scheduler

3/10/2011 9:21:34 AM
The Task Scheduler in Windows Server 2008 R2 replaces the Scheduled Tasks tool that was literally unchanged since the release of Windows 98. The main focal point of the tool is to assist administrators by automating tasks. In addition, by consolidating standard and reoccurring tasks into a central location, administrators gain insight into system functionality and control over their Windows Server 2008 R2 infrastructure through automation. These things together assist administrators in the areas of logging and debugging.

Windows Server 2008 R2 improves upon the previous version of the Scheduled Task tools included in Windows Server 2003 by allowing scheduled jobs to run more securely and with greater predictability. One of the most compelling new features of the Task Scheduler is that it fully integrates with Event Viewer. As such, a task can be triggered based on an event captured in the event log. This is a great feature because administrators can be automatically notified when a specific event transpires.

Understanding Task Scheduler

Scheduling tasks involves triggers and actions. A task runs once it is triggered. Tasks are initiated by triggers that are based on an event or time. Multiple triggers can be associated with a task as defined by an administrator. An action represents the work being performed as the task is being executed. Examples of actions include starting a program or sending an email. When a task is running multiple actions, up to 32 can be performed.

An additional functionality is task conditions. When a task is triggered, it will only run if specific defined conditions are met. Task conditions eliminate ambiguous situations by providing criteria-based functions. By improving on the Task Scheduler’s functionality, it has become a very powerful and extensive development and activation tool for automating and assisting with troubleshooting tasks.

With Windows Server 2008 R2, Task Scheduler has been moved from Control Panel to Administrative Tools. The new user interface is displayed in Figure 1.

Figure 1. The Task Scheduler user interface.

Tasks are created by selecting Create Basic Task, Create Task, or Import Task from the Actions pane in the Task Scheduler snap-in. When creating a task, there are five tabs of options that must be configured. They include general settings, triggers, actions, conditions, and additional settings. The upcoming sections explain the options when creating tasks.

Understanding Trigger Options and Settings

The first thing to consider when configuring a task is what triggers will cause the task to execute. Triggers can be based on time, events, or various system states. As noted earlier, each task can contain multiple triggers. With more than one trigger, the task will launch when any of the conditions in any of the triggers is met.

The following describes the various trigger types and the settings that can be configured for each type:

  • On a Schedule— Triggers for a schedule allow tasks to run on a specific date (one time), Daily, Weekly, or Monthly. For reoccurring tasks, the start time can be configured along with reoccurring options to completely customize when the task will run.

  • At Log On— Tasks scheduled to run when At Log On is set for any user or for a specific user or group of users.

  • At Startup— There are no specific settings for tasks configured to run at startup. This type of trigger runs whenever the system starts and the only settings are the advanced ones, which are described later in the chapter.

  • On Idle— The settings for tasks set to run when the computer is idle are set on the Conditions tab.

  • On an Event— This trigger causes a task to run when specific events are created in an event log. You can choose either a basic event trigger or custom event settings. Basic settings fire based on a single event from a specific event log. You choose which log contains the event, the publisher name, and the event ID. If you specify the custom event trigger settings, you can specify an XML event query or custom event filter to query for events that will fire the task.


  • At Task Creation/Modification— Tasks created with this trigger are fired as soon as they are created or whenever they are modified. The only settings for this trigger are the advanced settings as described in the next section, “Understanding the Advanced Settings Associated with Triggers.”

  • On Connection to User Session— The trigger fires when a user connects to the system using the Remote Desktop Connection program from another system and can be set to run when any user connects, or when a specific user or group connects to the server.

  • On Disconnect from User Session— This trigger works the same as the On Connection to User Session; however, it fires when users disconnect from the server from a Remote Desktop Connection session. The trigger can be set to run for all users or a specific user or group.

  • On Workstation Lock— The trigger fires when the workstation is locked. The settings for this trigger enable you to set it for all users or a specific user or group.

  • On Workstation Unlock— This trigger fires when the workstation is unlocked. The settings for this trigger enable you to set it for all users or a specific user or group.

Understanding the Advanced Settings Associated with Triggers

Advanced settings exist when creating triggers. Familiarize yourself with these advanced settings to ensure trigger creation and the workflow process is fully optimized. The following bullets explain each of the advanced settings associated with triggers:

  • Delay Task for or Delay Task for Up To (Random Delay)— Tasks can be delayed randomly so that they do not start immediately when the schedule triggers a task. For systems that might run the same tasks, this ensures there is some load balancing and that all systems do not run tasks at exactly the same time. Random delays can be set for 30 seconds, 1 minute, 30 minutes, 1 hour, 8 hours, or up to 1 day.

  • Repeat Task Every— Tasks can also be set to repeat at regular intervals and for a set duration (for example, a task could be set to ping a particular system every minute for 1 day, write an event to the event log in the case of a failure, and email a distribution group to notify the IT team about the issue).

  • Stop Any Task If It Runs Longer Than— Tasks can be stopped if they run past a defined amount of time and can be set to expire at a certain date and time.

  • Start and Expire— Start and Expiration times can be set to synchronize across time zones to ensure tasks set to run on systems in multiple time zones start and stop at the same time.

  • Enabled— Tasks can be enabled or disabled by checking or unchecking the enabled box.

Understanding the Actions Associated with a Task

As mentioned earlier, an action is the work conducted when a task runs. Tasks can have a single action or up to a maximum of 32 actions. The Actions tab of a task contains a list of actions associated with a particular task. An administrator can edit each action as follows:

  • Start a Program— This action starts a program or script. In the Program/Script text box, type either the name of the program or script that should be run. Alternatively, the administrator can browse the application or script. If further command-line arguments are required, these can be specified in the Add Arguments (Optional) text box. In the Start In (Optional) text box, the working directory can be specified for the command line that executes the program or script. This path is either the path to the program or script or to the files that are used by the executable.

  • Send an E-mail— This action sends an email when the task is triggered. In the Edit Action dialog box, you enter who the email is from, who it should be sent to, a subject, and any desired text. You must also enter a valid SMTP server.

  • Display a Message— This action simply displays a message on the console of the system where the task is created. You can enter a title for the message as well as any text that should be displayed. This type of action only launches if the Run Only If User Is Logged On security option has been selected on the General tab of the Task Properties in the Create Task dialog box.

Understanding Conditions Associated with a Task

Conditions in conjunction with triggers determine whether the task will run. Tasks will not run if any condition associated with a given task is not fulfilled. The following sections illustrate the types of conditions associated with a task:

  • Idle Conditions— A trigger can be based on idle time of a computer. Idle time is checked by the Task Scheduler service every 15 minutes. Computers are idle if a screensaver is running. When a screensaver is not running, the computer is considered to be idle if for 15 minutes the CPU usage and disk input or output were at 0% for 90% of the overall time. In this situation, mouse or keyboard input should also be nil during this period of time. The Task Scheduler service only waits for user input to mark the end of an idle state.

  • Power Conditions— Administrators can specify that tasks run only on computers operating on AC power. If administrators do not want a task to run when a computer is on battery power, a condition must be set to stop the task. Also, if the computer is off, a condition can be set to awaken the computer from a Sleep or Hibernate mode so the task can run. Although this is unlikely in a server environment, it’s still an option.

  • Network Conditions— Administrators can choose to start a task only if a specified network connection is available. This setting is appropriate if the action requires access to a remote system or network.

Note

The Network Conditions do not support interoperability with Windows 2000 or XP.


Understanding Task Settings

The Settings tab of the Tasks Properties or Create Task dialog box offers settings that help you control how the task is run, restarted, stopped, or deleted, as follows:

  • Allow Task to Be Run on Demand— If selected, this setting enables the administrator to manually start the task regardless of triggers or conditions by selecting the tasks and clicking Run in the Actions pane or right-clicking the task and selecting Run from the context menu.

  • Run Task as Soon as Possible After a Scheduled Start Is Missed— If this option is selected, a task that has been scheduled to start at a specific time but did not run (for example, the computer was off or the scheduler service was busy) will be started, but only after 10 minutes has elapsed from the original start time.

  • If the Task Fails, Restart Every— This setting controls what to do when a task does not run (for example, if a task fails to start a service due to an undetermined system problem). If this option is selected, an administrator can also configure the number of attempts that should be made to initiate the task.

  • If the Running Task Does Not End When Requested, Force It to Stop— If a task does not respond to a request to stop, an administrator can set a condition to force it to stop.

  • Stop the Task If It Runs Longer Than— If this item is checked, a limit on how long the task can run is enforced. As a result of this setting, a task might not be completed when it is stopped.

  • If the Task Is Not Scheduled to Run Again, Delete It After— This selection helps the administrator keep the Task Scheduler MMC free from old tasks that might have been put in place to accomplish a specific action but are no longer needed or will never be repeated. Note that a trigger must contain an expiration task.

  • If the Task Is Already Running: Do Not Start a New Instance— The task will not start a new instance if an instance of the task is already running.

  • If the Task Is Already Running: Run a New Instance in Parallel— A new task will run in parallel if one instance is running and the triggers and conditions cause the task to be triggered again.

  • If the Task Is Already Running: Queue a New Instance— A new task will queue, but it will not start until the first instance is complete and will not stop the instance that is already running.

  • If the Task Is Already Running: Stop the Existing Instance— A new task is triggered and conditions specified in the task will first stop the current instance and then start a new instance of the task.

Understanding Task History

The History tab on the properties page for a task contains events filtered from the Operational events for the Task Scheduler in the Event Viewer and enables an administrator to see success and failures for any given task without having to review all task-related event information for a system or collection of systems.

Note

Although the Task Scheduler enables an administrator to create folders for organizing tasks and new tasks can be given meaningful names, after a folder or task is created, it cannot be renamed. Further, tasks cannot be moved from one folder to another. However, tasks can be exported and then imported into a new folder or another system.

Top Search -----------------
- Windows Server 2008 R2 : Work with RAID Volumes - Understand RAID Levels & Implement RAID
- Windows Server 2008 R2 Administration : Managing Printers with the Print Management Console
- Configuring Email Settings in Windows Small Business Server 2011
- Windows Server 2008 R2 : Configuring Folder Security, Access, and Replication - Implement Permissions
- Monitoring Exchange Server 2010 : Monitoring Mail Flow
- Windows Server 2008 R2 :Task Scheduler
- Windows Server 2008 R2 : File Server Resource Manager
- Windows Server 2008 R2 : Installing DFS
- Exchange Server 2010 : Managing Anti-Spam and Antivirus Countermeasures
- Windows Server 2008 R2 : Configuring Folder Security, Access, and Replication - Share Folders
Other -----------------
- Using the Debugging Tools Available in Windows Server 2008 R2 (part 3)
- Using the Debugging Tools Available in Windows Server 2008 R2 (part 2) - TCP/IP Tools
- Using the Debugging Tools Available in Windows Server 2008 R2 (part 1) - Best Practices Analyzer Tools
- Windows Server 2008 R2 : Logging and Debugging - Setting Baseline Values
- Windows Server 2003 : Analyzing Traffic Using Network Monitor (part 3) - Adding Parsers to Network Monitor
- Windows Server 2003 : Analyzing Traffic Using Network Monitor (part 2) - How Network Monitor Works
- Windows Server 2003 : Analyzing Traffic Using Network Monitor (part 1)
- Windows Server 2003 : Configuring DNS Clients (part 2)
- Windows Server 2003 : Configuring DNS Clients (part 1) - Configuring Client Settings
- Windows Server 2008 R2 : GPO Administrative Tasks (part 6) - Backing Up and Restoring Domain GPOs
 
 
Most view of day
- Managing SharePoint 2010 with Windows PowerShell : Managing SharePoint 2010 Web Applications
- SharePoint 2010 : Connecting and Disconnecting Servers with Windows PowerShell, Additional Functionality in SharePoint 2010
- Maintaining Dynamics GP : Speeding security setup with User Copy
- Microsoft Exchange Server 2007 : Upgrading Separate AD Forests to a Single Forest Using Mixed-Mode Domain Redirect (part 2)
- Client Access to Exchange Server 2007 : Using Outlook 2007 Collaboratively (part 1)
- Microsoft Project 2010 : Fine-Tuning Task Details (part 11) - Inactivating Tasks
- Adobe Illustrator CS5 : Organizing Your Drawing - Enhancing Appearances with Live Effects
Top 10
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 3) - Translating Text with the Mini Translator
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 2) - Translating a Word or Phrase with the Research Pane
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 1) - Setting Options for the Research Task Pane, Searching with the Research Task Pane
- Microsoft OneNote 2010 : Doing Research with Linked Notes (part 2) - Ending a Linked Notes Session, Viewing Linked Notes
- Microsoft OneNote 2010 : Doing Research with Linked Notes (part 1) - Beginning a Linked Notes Session
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 3) - Moving Side Notes to Your Existing Notes
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 2) - Reviewing Side Notes
- Microsoft OneNote 2010 : Doing Research with Side Notes (part 1) - Creating Side Notes
- Games and Windows 7 : Installing and Playing Third-Party Games
- Games and Windows 7 : Using the Games Explorer (part 4) - Managing Your Game Controllers and Other Game-Related Hardware
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
Cars Review