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 RequirementsTask Name | Before or After Setup Windows and ConfigMgr | WinPE, Deployed OS, or Source OS | Other |
---|---|---|---|
Run Command Line | Either | WinPE or Deployed OS | |
Install Application | After | Deployed OS | |
Install Package | After | Deployed OS | |
Install Software updates | After | Deployed OS | |
Join Domain or Workgroup | After | Deployed OS | |
Connect to Network Folder | Either | WinPE or Deployed OS | |
Restart Computer | Either | WinPE or Deployed OS | |
Set Task Sequence Variable | Either | WinPE or Deployed OS | |
Format and Partition Disks | Before | WinPE | |
Convert Disk to Dynamic | Either | WinPE or Deployed OS | |
Enable BitLocker | After | Deployed OS | |
Disable BitLocker | Before | Source OS | |
Request State Store | Either | Any | |
Capture User State | Before | WinPE or Source OS | The 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 State | After | Deployed OS | The 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 Store | Either | Any | This 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 Image | Before | WinPE | |
Apply Data Image | Before | WinPE | |
Setup Windows and ConfigMgr | N/A | WinPE | |
Install Deployment Tools | After | Deployed OS | |
Prepare ConfigMgr Client for Capture | After | Deployed OS | |
Prepare Windows for Capture | After | Deployed OS | |
Capture Operating System Image | After | WinPE | |
Auto Apply Drivers | Before | WinPE | |
Apply Driver Package | Before | WinPE | |
Capture Network Settings | Before | Source OS | |
Capture Windows Settings | Before | Source OS | |
Apply Network Settings | Before | WinPE | |
Apply Windows Settings | Before | WinPE |
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:
- Task sequence variables set at run-time (using a Set Task Sequence Variable task or the Microsoft.SMS.TSEnvironment COM object)
- Task sequence variables set on computer resources
- Task sequence variables set on collections
- 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 VariablesVariable | Tasks | Purpose |
---|---|---|
OSDDomainOUName | Apply Network Settings | Specifies 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 |
OSDDomainName | Apply Network Settings | Specifies the name of a Windows domain the destination computer joins. |
OSDComputerName | Apply Windows Settings | Specifies the name of the computer. |
OSDTimeZone | Apply Windows Set-tings | Specifies the default time zone setting that is used in the new OS. |
OSDStateStorePath | Capture User State, Release State Store | The UNC or local path name of the folder where the user state is saved. |
OSDMigrateAdditional CaptureOptions | Capture User State | Specifies (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. |
SMSClientInstallProperties | Setup Windows and ConfigMgr | Specifies the client installation properties used when installing the Configuration Manager client. |
SMSTSRebootDelay | N/A | Specifies 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. |
SMSTSAssignUsersMode | N/A | Used for enabling user device affinity (UDA). |
In this tutorial:
- Operating System Deployment
- What is OSD
- What is New in OSD
- Deployment Scenarios
- Tools Incorporated into OSD
- Windows Automated Installation Kit
- User State Migration Tool and USMT Customization
- OSD Phases
- OSD Building Blocks
- Driver Packages
- Operating System Installers
- Drivers in Boot Images
- Task Sequences
- Task Sequence Properties
- Task Placement
- Task Conditions and Grouping
- Targeting and Execution
- Execution Context
- Customizing Task Sequences
- Site System Roles
- Multicast
- State Migration Point
- Driver Management
- Drivers in the Image
- User State
- USMT
- Computer Associations
- User State Without SMP
- Image Operations
- Manual Image Creation
- Image Upkeep
- Image Deployment
- User Device Affinity
- Deployment Challenges
- Hardware Considerations
- Monitoring Task Sequence Deployments
- Troubleshooting Operating System Deployment
- The Smsts.log File