Windows 7 / Getting Started

Task Placement

Most tasks must be placed in relation to certain other tasks in a task sequence for them to properly function, specifically the Setup Windows and ConfigMgr task. While it is technically possible to place many tasks before or after this task, it doesn't usually make sense to do so. In addition, some tasks are only applicable when run in WinPE, the target instance of Windows being deployed, or the source instance of Windows in a refresh scenario.

Table-2 lists these various placement requirements.

TABLE-2 Task Placement Requirements
Task NameBefore or After Setup Windows and ConfigMgrWinPE, Deployed OS, or Source OSOther
Run Command LineEitherWinPE or Deployed OS
Install ApplicationAfterDeployed OS
Install PackageAfterDeployed OS
Install Software updatesAfterDeployed OS
Join Domain or WorkgroupAfterDeployed OS
Connect to Network FolderEitherWinPE or Deployed OS
Restart ComputerEitherWinPE or Deployed OS
Set Task Sequence VariableEitherWinPE or Deployed OS
Format and Partition DisksBeforeWinPE
Convert Disk to DynamicEitherWinPE or Deployed OS
Enable BitLockerAfterDeployed OS
Disable BitLockerBeforeSource OS
Request State StoreEitherAny
Capture User StateBeforeWinPE or Source OSThe task must be preceded by a Request State Store task and followed by a Release State Store task if you want to store the state data on a state migration point.
Restore User StateAfterDeployed OSThe task must be preceded by a Request State Store task and followed by a Release State Store task if you want to retrieve the state data from a state migration point.
Release State StoreEitherAnyThis task must follow a Request State Store task. Typically a Capture User State or Restore User State task is inserted in between.
Apply Operating System ImageBeforeWinPE
Apply Data ImageBeforeWinPE
Setup Windows and ConfigMgrN/AWinPE
Install Deployment ToolsAfterDeployed OS
Prepare ConfigMgr Client for CaptureAfterDeployed OS
Prepare Windows for CaptureAfterDeployed OS
Capture Operating System ImageAfterWinPE
Auto Apply DriversBeforeWinPE
Apply Driver PackageBeforeWinPE
Capture Network SettingsBeforeSource OS
Capture Windows SettingsBeforeSource OS
Apply Network SettingsBeforeWinPE
Apply Windows SettingsBeforeWinPE

Variables

A major advantage that task sequences have over the traditional software delivery mechanism used in Systems Management Server (SMS) and now ConfigMgr is that they maintain state between steps. This state is embodied in a series of built-in variables and custom variables that survive reboots because they are stored in a locally persistent file, allowing you to pass data or configuration items from one step to the next. The task that the task sequence is currently executing is also part of the task sequence's state; in fact, every detail about a task sequence is stored as one or more task sequence variables. Variables are encrypted for security when initially transmitted between ConfigMgr and the target system and are securely stored on the target system. Here are the three types of variables available:

  • Action: Specify parameters for specific tasks. Nearly all are directly editable using the task sequence editor.
  • Custom: Simple name and value pairs that you can define as you see fit.
  • Built-in: Mostly read-only, start with an underscore, are generated automatically by the task sequence, and generally describe the environment where the task sequence executes.

The full list of task sequence action and built-in variables is available at http://technet. microsoft.com/en-us/library/gg682064.aspx . Each UI field shown in a task in the task sequence editor has a corresponding task sequence variable. Setting these values in the UI defines the action's design time behavior. This is great if you want a completely static task sequence that always does the same thing. Setting task sequence variables based upon collection membership or using a script during the execution of the task sequence makes your task sequences dynamic, performing tasks differently or even performing different tasks based upon run-time conditions. Action variables and custom variables can be set in a number of ways:

  • Using a Set Task Sequence Variable task
  • Statically assigning them to a specific computer resource
  • Statically assigning them to a collection
  • Using the Microsoft.SMS.TSEnvironment COM object in a script or other COM aware tool, development environment, or language. See http://msdn.microsoft.com/ en-us/library/cc145669.aspx for more information on using this COM object

You can also set a task sequence variable on a device collection or a computer resource in the ConfigMgr console. For device collections, open the collection's Properties dialog and navigate to the Collection variables page; for a computer resource, open the resource's Properties dialog and navigate to the Variables page. Task sequences initiated on applicable resources will have all variables initially set.

If you leave the value of a collection or computer variable blank, the built-in task sequence UI prompts the user for values for these empty variables. The article at http://blog.configmgrftw.com/?p=44 provides a detailed description of this capability.

Here is the precedence for task sequence variables:

  1. Task sequence variables set at run-time (using a Set Task Sequence Variable task or the Microsoft.SMS.TSEnvironment COM object)
  2. Task sequence variables set on computer resources
  3. Task sequence variables set on collections
  4. Task sequence variables set at design-time in the GUI

You can use variables for these tasks:

  • Conditionally execute tasks. (See an example of this in the "Conditions and Groupings" section.)
  • Perform string replacement in any text field in any task.
  • Provide task-specific parameter values.
  • Perform string replacement in unattended files.

For string replacement and parameter values, surround the name of the variable with % symbols; for example for a variable named MyCustomVar, use %MyCustomVar%. The task sequence engine replaces this with the value of the variable. For example, using the following command as the command line for a Run Command Line task demonstrates adding an entry to the registry that you can later utilize to track the deployment version used when creating the system.

reg /add HKLM\Software\Odyssey\OSDBuild /v Version /t REG_STRING /d %OSDBUILDVERSION%

You can supply the actual value of OSDBUILDVERSION, and thus the version written to the registry, using any of the methods previously discussed in this section.

The "Task Conditions and Grouping" section gives an additional example of using custom variables. Some notable task sequence variables often set dynamically at run-time of the task sequence to customize the OS deployment outcome are listed in Table-3.

TABLE-3 Notable Task Sequence Variables
VariableTasksPurpose
OSDDomainOUNameApply Network SettingsSpecifies the full path to the organizational unit (OU) that the computer joins (in RFC 1779 format).
For example: LDAP://OU=MyOu,DC=MyDom, DC=MyCompany,DC=com
OSDDomainNameApply Network SettingsSpecifies the name of a Windows domain the destination computer joins.
OSDComputerNameApply Windows SettingsSpecifies the name of the computer.
OSDTimeZoneApply Windows Set-tingsSpecifies the default time zone setting that is used in the new OS.
OSDStateStorePathCapture User State, Release State StoreThe UNC or local path name of the folder where the user state is saved.
OSDMigrateAdditional CaptureOptionsCapture User StateSpecifies (USMT) command line options used when capturing the user state, but not exposed in the ConfigMgr user interface. The additional options are specified in the form of a string that is appended to the automatically generated USMT command line.
SMSClientInstallPropertiesSetup Windows and ConfigMgrSpecifies the client installation properties used when installing the Configuration Manager client.
SMSTSRebootDelayN/ASpecifies how many seconds to wait before the computer restarts. The task sequence manager will display a notification dialog before reboot if this variable is not 0.
SMSTSAssignUsersModeN/AUsed for enabling user device affinity (UDA).
[Previous] [Contents] [Next]