Task

Applies To: System Center 2012 - Operations Manager, System Center 2012 R2 Operations Manager, System Center 2012 SP1 - Operations Manager

Defines an on-demand workflow designed to be initiated by the user on an agent computer.

Schema Hierarchy

ManagementPack
  Monitoring
    Tasks
      Task

Syntax

<Task ID=”TaskID” Comment=”Comment” Accessibility=”Public/Internal” Enabled=”True/False” Target=”TargetClassID” Timeout=”int” Remotable=”True/False”>   <Category>CategoryName</Category>
   <ProbeAction></ProbeAction>
   <WriteAction></WriteAction>
</Task>

Attributes and Elements

The following sections describe attributes, child elements, and parent the element of the Task element.

Attributes

Attribute Description

ID

Required attribute. Represents the identity of the element. To learn how to identify your element in a management pack, see Element Identity and Namespace Conventions.

Comment

Optional attribute. Represents commentary by the management pack author.

Enabled

Required attribute. Defines whether or not this workflow is by default enabled or disabled.

Target

Required attribute. The ID of the targeted class type.

Timeout

Optional attribute. The time at which the running task will be terminated.

Remotable

Optional attribute. Defines whether or not this workflow will run for agentless monitoring. Default value is true.

Enabled Attribute Values

Value Description

True

The workflow is enabled and will run when its target class has been discovered.

False

The workflow is disabled and will not run even when its target class has been discovered.

Target Attribute Values

Value Description

The ID of the targeted ClassType.

A rule is always targeted at a particular class type and runs against every instance of that class type.

Child Elements

Element Description

Category (Task)

Represents the category name of the task. For the list of allowable names, see Category (Task).

ProbeAction (Task)

Required element if no WriteAction module is specified. Represents an implementation of a probe action module type definition.

WriteAction (Task)

Required element if no ProbeAction module is specified. Represents an implementation of a write action module type definition.

Parent Elements

Element Description

Tasks

Contains rule definitions targeted at a specific entity type in the service model.

Remarks

A Task element, unlike a ConsoleTask element, runs on the agent computer, while a console task runs only on the computer that is hosting the Operations console.

Tasks are workflows that contain either one WriteAction module or one ProbeAction module, or one of each.

Tasks are always initiated by the user through the user interface. The target of a task determines when the user interface for initiating the task will display for the user.

A probe action module type is used when the task is probing but not changing the system. For example, the IPConfig /All command runs as a probe action module. A write action module type is used when the task is changing the system in some way. For example, the IPConfig /Renew command should run as a write action.

Example

The following XML sample illustrates a probe action task that queries local users on the computer.

<Task ID="Microsoft.Windows.Server.2003.Computer.LocalUsersQuery.Task" Target="Microsoft.Windows.Server.2003.Computer" Accessibility="Public">
  <Category>Maintenance</Category>
  <ProbeAction ID="PA" TypeID="System!System.CommandExecuterProbe">
    <ApplicationName>%WINDIR%\System32\NET.EXE</ApplicationName>
    <WorkingDirectory/>
    <CommandLine>USER</CommandLine>
    <TimeoutSeconds>30</TimeoutSeconds>
    <RequireOutput>true</RequireOutput>
    <Files/>
  </ProbeAction>
</Task>

The next XML sample illustrates a write action task that starts Terminal Service.

<Task ID="Microsoft.Windows.Server.2008.TerminalServicesRole.Service.TerminalServer.Start" Accessibility="Public" Enabled="true" Target="Microsoft.Windows.Server.2008.TerminalServicesRole.Service.TerminalServer" Timeout="300" Remotable="true">
  <Category>Maintenance</Category>
  <WriteAction ID="WA" TypeID="System!System.CommandExecuter">
    <ApplicationName><![CDATA[%SystemRoot%\System32\net.exe]]></ApplicationName>
    <WorkingDirectory><![CDATA[%SYSTEMROOT%\temp]]></WorkingDirectory>
    <CommandLine>start TermService</CommandLine>
    <TimeoutSeconds>300</TimeoutSeconds>
    <RequireOutput>true</RequireOutput>
    <Files />
  </WriteAction>
</Task>

See Also

Reference

Rules