In BDD 2007, the task
sequence is a list of tasks to run during deployment. However, it’s not a
linear list of tasks like a batch script. The task sequence is
organized into groups and specifies conditions, or filters, that can
prevent tasks and entire groups from running in certain situations.
BDD 2007 uses a task sequencer
to run the task sequence. The task sequencer runs the task sequence
from top to bottom in the order specified. Each task in the sequence is a
step, and steps can be organized in to groups and subgroups. When you
create a build in Deployment Workbench, Deployment Workbench creates a
default task sequence for the build. A key feature of the task sequence
is that it stores state data, or variables, on the destination computer.
These variables persist, even across reboots. The task sequencer can
then use these variables to test conditions and possibly filter tasks or
groups. The task sequencer can also restart the computer and gracefully
continue the task sequence where it left off. These are important
characteristics when driving a deployment process from beginning to end.
Task sequences contain the following types of items:
Tasks
Within a task sequence, tasks do the actual work. Tasks are commands
that the task sequencer runs during the sequence, such as partitioning
the disk, capturing user state, and installing the operating system. In
the default task sequence, most tasks are commands that run scripts. Groups
The task sequence can be organized into groups, which are folders that
can contain subgroups and tasks. Groups can be nested as necessary. For
example, the default task sequence puts tasks in groups by phase and
deployment type.
You can filter both tasks and groups, including
the groups and tasks they contain, based on conditions that you specify.
Groups are especially useful for filtering, because you can run an
entire collection of tasks based upon a condition such as the deployment
phase or type of deployment.
To edit a build’s task sequence
1. | In the Deployment Workbench console tree, click Builds.
| 2. | In the details pane, right-click the build you want to edit, and then click Properties.
| 3. | Click the Task Sequence tab, edit the task sequence as described in Table 1, and then click OK.
Table 1. Editing a Build’s Task SequenceTo | Use these steps |
---|
Add a group | In
the task sequence, select the item beneath which you want to create a
new group, click Add, and then click Group. Deployment Workbench creates
and selects a new group called New Group. | Add a task | In
the task sequence, select the item beneath which you want to create a
new task, click Add, and then click Task. Deployment Workbench creates
and selects a new task called New Task. | Add a reboot | In
the task sequence, select the item beneath which you want to add a
reboot, click Add, and then click Reboot. Deployment Workbench creates
and selects a new task that restarts the destination computer. A reboot
is an ordinary task that runs the command smsboot.exe /target:HD to
restart the computer and continue the task sequence. | Add an application | In
the task sequence, select the item beneath which you want to add an
application installation, click Add, and then click Application, ApplicationName, where ApplicationName
is the name of the application you want to install. Deployment
Workbench creates and selects an installation task for the application
using the information provided when adding the application to the
distribution share. An application is an ordinary task that runs the
command specified when the application is added to the distribution
share. |
|
Caution If
you install antivirus software as part of the task sequence, be sure to
test how the antivirus software interacts with the deployment process
carefully before moving to a production environment. Antivirus software
can prevent BDD 2007 from successfully deploying Windows Vista and
applications. If necessary, you can always disable the antivirus
software and then re-enable it at the end of the task sequence. |
To edit an item in a build’s task sequence
1. | In the task sequence, select the item to edit, and then edit the settings in the right pane.
|
To remove an item in a build’s task sequence
1. | In
the task sequence, select the item to remove, and then click Remove. If
a group is removed, Deployment Workbench removes the group and
everything it contains, including subgroups and tasks.
|
To reorder an item in a build’s task sequence
1. | In
the task sequence, select the item you want to reorder, and then click
Up or Down to change its position within the task sequence. During
deployment, the Windows Deployment Wizard runs the tasks from top to
bottom in the order specified.
|
Configuring Group and Task Properties
In the task sequence, every group and task has a
Properties tab. Each group and task has a name and description that you
can edit on the Properties tab. Tasks also have a command line and a
starting folder location that you can edit. The following list describes
what you see on the Properties tab:
Name
In the Name box, type a short, descriptive name for the group or task.
During deployment, this name appears in the task sequencer’s status
window. Description In the Description box, type a description of the group or task. Command Line (tasks only)
In the Command Line box, type the command to run at this step in the
task sequence. Include any command-line arguments. Environment variables
are also permitted in command lines. Start In (tasks only)
In the Start In box, type the path in which to start the command. This
path specifies the current working directory for the command. If you do
not provide a path in this box, the paths in the Command Line box must
be fully qualified or the command must be in the path.
Configuring the Options Tab
Groups and tasks have the following settings on the Options tab (shown in Figure 1):
Disable This Step Select the Disable This Step check box to disable the task or group, including all groups and tasks it contains. Success Codes (tasks only)
List the return codes that indicate successful completion. The Windows
Deployment Wizard determines whether a task completed successfully by
comparing its return code to each code in the Success Codes box. If it
finds a match, the task completed successfully. Continue On Error
If an error occurs in the current task, select the Continue On Error
check box to continue with the next step in the task sequence. If you
clear this check box, the Windows Deployment Wizard stops processing and
displays an error message if the task or group did not complete
successfully.
Additionally, on the Options tab, you can filter
the group or tasks based on conditions specified in the Conditions
list. If the condition evaluates to true, the group or task runs. If the
condition evaluates to false, the group (and all of the groups and
tasks it contains) or task does not run. See the following sections for
more information about conditions you can add to the Conditions list.
Task Sequence Variables
Task sequence variables allow you to compare a
variable to a static value using a variety of conditions, such as equal,
greater than, and less than. The task sequencer maintains numerous variables
that you can use in these tests. For example, the task sequencer
defines a variable called DeploymentMethod that indicates the method of
deployment. One possible value of DeploymentMethod is OSD. For a
complete list of variables that the task sequencer maintains, see the Configuration Reference in BDD 2007.
To add a variable to an item’s Conditions list
1. | On
the Options tab, click Add, and then click Task Sequence Variables to
display the Task Sequence Variable Condition dialog box.
| 2. | In the Variable box, type the name of the variable you want to test. For a full list of variables that you can test, see the Configuration Reference in BDD 2007.
| 3. | From the Condition list, choose one of the following conditions:
exists equals not equals greater than greater than or equals less than less than or equals
| 4. | In the Value box, type the static value you want to compare to the variable using the condition specified in the previous step.
|
If Statements
Use If statements to combine variables into
bigger expressions. For example, create an If statement that evaluates
to true only if all the conditions it contains are true. (This is the
same as a logical AND.) Create an If statement that evaluates to true if
any of the conditions it contains are true. (This is the same as a
logical OR.)
To add an If statement to an item’s Conditions list
1. | On the Options tab, click Add, and then click If Statement to display the If Statement Properties dialog box.
| 2. | In the If Statement Properties dialog box, choose one of the following options, and then click OK:
All conditions (and) Any conditions (or) None
| 3. | From
the Conditions list, select the If statement added in the previous
step, and then add task sequence variables to it as described in the
previous section.
|
If you chose All Conditions, all variables
added must evaluate to true for the group or task to run. If you chose
Any Conditions, the group or task will run if any one of the variables
added evaluates to true.
Note You can nest If
statements to create complex logic. If you are familiar with Boolean
logic, represent Boolean expressions as If statements in the Conditions
list. |
Operating System Versions
The task sequencer allows you to filter tasks
and groups based on the computer’s current operating system. For
example, you can choose to run a preinstallation task only if the
destination computer is currently running Windows XP Professional SP2.
To add an operating system filter to an item’s Conditions list
1. | On the Options tab, click Add, and then click Operating System Version to display the Task Sequence OS Condition dialog box.
| 2. | From the Architecture list, click either X86 or X64.
| 3. | From the Operating system list, choose an operating system version and a service pack level.
| 4. | From the Condition list, choose one of the following conditions:
equals not equals greater than greater than or equals less than less than or equals
|
WMI Queries
The task sequencer allows you to filter tasks
and groups based on WMI queries. The WMI query must return a collection.
If the collection is empty, the result evaluates to false. If the
collection is not empty, the result evaluates to true. The following are
some sample WMI queries you could use to filter tasks in the task
sequence:
SELECT * FROM Win32_ComputerSystem
WHERE Manufacturer = ‘Dell Computer Corporation’. This is true only if
WMI reports the computer’s manufacturer as Dell Computer Corporation. SELECT
* FROM Win32_OperatingSystem WHERE OSLanguage = ‘1033’. This is true
only if WMI reports the operating-system language as 1033. SELECT * FROM Win32_Service WHERE Name = ‘WinMgmt’. This is true only if the WinMgmt service is available. SELECT
* FROM Win32_Processor WHERE DeviceID = ‘CPU0’ AND Architecture = ‘0’.
This is true only if the processor architecture is x86. SELECT * FROM Win32_Directory WHERE Name = ‘D:\Somefolder’. This is true only if D:\Somefolder exists on the computer.
To add a WMI query to an item’s Conditions list
1. | On the Options tab, click Add, and then click Query WMI to display the Task Sequence WMI Condition dialog box.
| 2. | In the WMI Namespace box, type the WMI namespace in which to run the query. The default namespace is root\cimv2.
| 3. | In the WQL Query box, type the WMI query.
|
|