PowerShell 1 min read

Add Custom Task Sequence Variables and Read Them in PowerShell

Michael Wu ·

Custom Task Sequence (TS) variables prove useful when managing different image deployments. These variables can control which applications or software get deployed by being read during the process.

Overview

This article discusses leveraging PowerShell MVP Stéphane van Gulick’s “OSD tattoo script” to manipulate task sequence variables. This script performs two key functions:

  • Reading TS variables
  • Writing them into Registry, WMI, and Environment variables

Implementation Steps

Step 1: Create Task Sequence Variables

Create custom Task Sequence variables directly within the Task Sequence configuration interface in the SCCM console.

Step 2: Add PowerShell Script with Parameters

Add the PowerShell script to your task sequence along with the necessary parameters for execution.

Step 3: Modify New-OSDTattoo.ps1

Update the New-OSDTattoo.ps1 script to handle your custom TS variables. Add your custom lines under the PSDistrict_ variables section in the main script region (around line 911 of the script).

Results

Following deployment to a test computer, the custom variables become visible in the system Registry, confirming successful writing of the task sequence variable data.