Operating System Deployment Task Sequence Object Model

In Configuration Manager, operating system deployment task sequences are created and edited by using a Windows Management Instrumentation (WMI) class-based object model.

Caution

Changing task sequences by updating the task sequence XML is not supported. You will only need the XML when exporting the task sequence to different site. The XML is stored in the SMS_TaskSequencePackage Server WMI ClassSequence property.

Task Sequence Packages

A task sequence is packaged in an instance of the SMS_TaskSequencePackage Server WMI Class class and there is a single package for each task sequence. The package is advertised to client computers by using an instance of the SMS_Advertisement Server WMI Class class. To associate the task sequence package with the advertisement, you set the SMS_Advertisement Server WMI Class PackageID property to the SMS_TaskSequencePackage Server WMI Class PackageID property.

Note

SMS_TaskSequencePackage Server WMI Class derives from SMS_Package Server WMI Class and can be used in the same way that packages are used. For more information, see Software distribution overview.

For more information about creating a task sequence package, see How to Create an Operating System Deployment Task Sequence Package.

For more information about creating advertisements, see How to Create an Advertisement.

Task Sequences

To create and manage task sequences, Configuration Manager provides a number of WMI classes that represent a task sequence, task sequence steps (actions and groups) and step conditions.

The key WMI classes are:

SMS_TaskSequence

The SMS_TaskSequence class represents an individual task sequence. You can either create new instances of SMS_TaskSequence, or you can use the method SMS_TaskSequencePackage.GetSequence to populate an SMS_TaskSequence with an existing task sequence.

Note

If you create a new SMS_TaskSequence, you must associate it with a SMS_TaskSequencePackage. Otherwise, Configuration Manager is not aware of its existence.

The class property SMS_TaskSequence.Steps is an array of SMS_TaskSequence_Step derived classes. These steps are processed sequentially when the task sequence is run.

SMS_TaskSequenceStep

The two types of steps, action and group, derive from the SMS_TaskSequenceStep class. The two types of steps are the SMS_TaskSequence_Group class for groups and the SMS_TaskSequence_Action derived class for the Configuration Manager built-in, or custom, actions.

A step has a number of properties that you can set.

Property Description
Condition A condition that must be met for the step to be processed. This in an instance of the SMS_TaskSequence_Condition class.
ContinueOnError If set to true, the task sequence will continue to the next step when an error occurs. Otherwise the task sequence will propagate the failure back to the parent. If the parent is a group, the parent group's ContinueOnError property is evaluated. If the parent is the task sequence root, the task sequence will fail.
Enabled If set to true, the step is processed. Otherwise, the step is not processed.

The step also has a Name and Description property.

Note

This documentation refers to steps when the procedure is applicable to both actions and groups. For example, How to Remove a Step From an Operating System Deployment Group is a task that is applicable to both action removal and group removal.

SMS_TaskSequenceAction

Configuration Manager defines a number of built-in actions that are defined in classes derived from the SMS_TaskSequence_Action class. For example, the action that allows you to specify a command line is the SMS_TaskSequence_RunCommandLineAction class.

Note

The built-in actions are named SMS_TaskSequence_ActionNameAction where ActionName is the name of the built-in action. For more information, see SMS_TaskSequence_Action server WMI class.

In addition to the properties that are inherited from SMS_TaskSequenceStep, a derived action inherits the following properties from the SMS_TaskSequence_Action class that you can set:

Property Description
SupportedEnvironment Specifies the operating environment that the action can be run in. Valid values are "WinPE", "FullOS", "WinPEandFullOS.
Timeout Specifies the time-out period for the action, in seconds.

SMS_TaskSequenceGroup

The SMS_TaskSequence_Group Server WMI Class class represents a set of steps that are processed sequentially. SMS_TaskSequence_Group Server WMI Class Steps property is an array of SMS_TaskSequence_Step Server WMI Class classes that represent the group's steps. Because a group step is derived from SMS_TaskSequence_Step Server WMI Class, there can be further child groups within the steps.

SMS_TaskSequence_Condition

Each SMS_TaskSequence_Step Server WMI Class and the derived classes (actions and groups) can have an associated condition that must be met for the condition to be run. For example, you may want to process a step on a computer with Microsoft Office 2007 installed. Additionally, you may also want to further restrict the step to the Windows Vista operating system.

Note

For the condition to be processed, the SMS_TaskSequenceStep class Enabled property must be set to true.

Within a task sequence step, the SMS_TaskSequence_Step Server WMI Class Condition property contains a SMS_TaskSequence_Condition Server WMI Class object that holds the condition. The condition is made up of one or more operands that are defined in an array of SMS_TaskSequence_ConditionOperand Server WMI Class derived classes by the Operands property. Each operand is an expression that must evaluate to true, for the step to be processed - a logical and operation.

Expressions

Individual expressions are defined in SMS_TaskSequence_ConditionExpression Server WMI Class derived classes.

Note

SMS_TaskSequence_ConditionExpression derives from SMS_TaskSequenceConditionOperand.

For example, you would use SMS_TaskSequence_SoftwareConditionExpression Server WMI Class to define an expression for Microsoft Office 2007. The class used to define an expression for Windows Vista would be SMS_TaskSequence_OSConditionGroup Server WMI Class.

Nested Expressions

You can define more complex conditions containing nested expressions with SMS_TaskSequence_ConditionOperator Server WMI Class. This class also derives from SMS_TaskSequence_ConditionOperand Server WMI Class.

For example, you can form the condition Exp1 and (Exp2 or Exp3) by adding the following condition operands to a task sequence step's SMS_TaskSequence_Condition Server WMI Class instance's Operand array property.

Note

The operands in the task sequence step's SMS_TaskSequence_Condition Server WMI ClassOperand array property are automatically compared with the and operator to evaluate the condition. The expressions in the SMS_TaskSequence_ConditionOperator must have an operator defined by the Operator property.

Since the SMS_TaskSequence_Condition Server WMI ClassOperands property is an array of SMS_TaskSequence_ConditionOperand Server WMI Class classes, you can create more complex conditions such as Exp1 and (Exp2 or (Exp3 and Exp4)).

For more information about conditions, see How to Add a Condition to an Operating System Deployment Task Sequence Step.

See Also

SMS_TaskSequence_ConditionOperand Server WMI Class
How to Add a Condition to an Operating System Deployment Task Sequence Step