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.
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 Class
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.
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.
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:
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.
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.
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.
|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
|Enabled||If set to
The step also has a Name and Description property.
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.
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.
The built-in actions are named SMS_TaskSequence_
ActionName is the name of the built-in action. For more information, see SMS_TaskSequence_Action server WMI class.
|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.|
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.
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.
For the condition to be processed, the
Enabled property must be set to
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
Individual expressions are defined in SMS_TaskSequence_ConditionExpression Server WMI Class derived classes.
SMS_TaskSequence_ConditionExpression derives from
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.
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.
Exp2 or Exp3).
The SMS_TaskSequence_ConditionOperator Server WMI Class
Operandsarray property contains the expressions
Exp3and the SMS_TaskSequence_ConditionOperator Server WMI Class
Operatorproperty contains the desired operator. In this case
The operands in the task sequence step's SMS_TaskSequence_Condition Server WMI Class
Operand 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
Since the SMS_TaskSequence_Condition Server WMI Class
Operands 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.