Topics: Task Sequences

Task Sequences

Task sequences extend deployment recipes with custom scripts, commands, and configuration steps that execute at defined points during the deployment process. The core deployment pipeline (partitioning, imaging, driver injection, answer file) remains immutable - task steps are additive.

Execution Phases

Steps are organized into seven phases that map to insertion points between the fixed deployment stages:

Phase Runs After Environment
PreImaging Disk partitioning WinPE, disks formatted but empty
PostImaging WIM apply + bcdboot WinPE, W:\ has Windows installed
PreDriverInjection Secure Boot detection WinPE
PostDriverInjection Offline driver injection WinPE
PreAnswerFile Before answer file write WinPE
PostAnswerFile After unattend.xml written WinPE, last chance before reboot
FirstBoot First Windows boot (RunOnce) Full Windows OS

Step Types

Type Description
RunCommand Execute a command line via cmd.exe /c
RunPowerShell Run a PowerShell script (saved as temp .ps1 file)
RunBatchScript Run a batch script (saved as temp .bat file)
CopyFile Copy a file from source to destination path
SetVariable Store a named variable for use in subsequent steps
Restart Reboot the machine (WinPE: wpeutil reboot, FirstBoot: shutdown /r)
RegistryEdit Edit the registry (offline load/unload in WinPE, live in FirstBoot)

Step Configuration

Each step supports:

  • Timeout - Maximum execution time in seconds (default 300, max 7200)
  • Continue on Error - Whether deployment continues if this step fails
  • Retry Count - Number of retry attempts (0-5) with configurable delay
  • Enabled/Disabled - Toggle steps without deleting them
  • Conditions - JSON-based conditional execution

Routine edits (rename, timeout, retry count, script content) save straight from the step editor. A change summary is shown for confirmation only when the edit moves the step to a different execution phase, which changes when it runs. Deleting a step asks first, because it also renumbers the remaining steps in that phase and cannot be undone.

Variables

Built-in variables are expanded automatically in step content using %VARNAME% syntax:

  • %MACHINE_NAME% - Assigned hostname
  • %MACHINE_ID% - Machine database ID
  • %WINDOWS_DRIVE% - Windows partition letter (typically W:)
  • %ESP_DRIVE% - EFI System Partition letter (typically S:)
  • %IMAGE_NAME% - Name of the WIM image being deployed

Custom variables can be set with the SetVariable step type and referenced in subsequent steps.

%WINDOWS_DRIVE% in FirstBoot steps

FirstBoot steps run after Windows has started, and by then the Windows partition is the system drive rather than the WinPE letter. %WINDOWS_DRIVE% follows that: in a FirstBoot step it resolves to the running Windows volume, and in every earlier phase it stays the WinPE letter.

Two cases are rejected when the deployment writes the FirstBoot scripts, rather than silently producing a path that will not exist on the finished machine:

  • A RunPowerShell FirstBoot step that uses %WINDOWS_DRIVE%. PowerShell does not expand %...% variables, so there is no correct substitution to make inside a script body. Write $env:SystemDrive instead, or use a RunCommand or RunBatchScript step.
  • A FirstBoot step naming the WinPE letter directly (a literal W:\... path, or a variable set during an earlier phase that already holds one). Use %WINDOWS_DRIVE% in the FirstBoot step.

Both stop the deployment with an error naming the step, so the recipe can be corrected before any machine is delivered with a first-boot step that would never have run.

Conditions

Steps can include a JSON condition that determines whether they execute:

{
  "type": "variable",
  "operator": "equals",
  "name": "MACHINE_NAME",
  "value": "KIOSK-*"
}

Supported condition types: variable (exists/equals/contains), hostnamePattern, and compound and/or with children arrays.

Step Templates

The recipe detail page includes pre-built templates for common tasks:

  • Enable .NET Framework 3.5
  • Set Timezone
  • Disable IPv6
  • Configure Power Settings
  • Disable Hibernation
  • Run Windows Update

FirstBoot Steps

Steps in the FirstBoot phase execute after the machine reboots into the full Windows OS. They are written to W:\FluxDeploy\FirstBoot\ during WinPE and registered via the RunOnce registry key (loaded/modified/unloaded offline). The master batch script self-cleans after execution.

Windows Server images start the same script from a one-shot SYSTEM startup task registered by SetupComplete.cmd instead of waiting for a logon (a headless Server never has one), unless a step assumes a signed-in user. See Deploying Windows Server.