If you want to know how to read and write custom variables in a SCCM task sequence then you will want to read this. (Part 1 of 2)
I’ve been looking for a method of reading and writing custom variables from within a task sequence as I will shortly be writing a Powershell GUI front-end for our imaging task and being able to do this step is an essential pre-requisite to achieving my end goal.
I used three Microsoft articles in my research on how to do this:
- About Task Sequence Variables
- Task Sequence Built-In Variables
- Prestart commands for task sequence media
I thought I would try a ‘real-world’ example – something that may have some real value in the workplace – while I tried to figure out how all of this worked. I decided to use the tried and tested “Hello World!” SCCM equivalent of logging the following information into the computers registry once imaging was complete :
- Date image started
- Image Start time
- Image End Time
- Total time taken to image
- Task sequence used to image
- Name of image used
Here is a screenshot of the final result taken from the registry of an imaged computer:
Part 2 explains how I went about achieving this.