I’ve been looking for a method of reading and writing custom variables from within a SCCM 2012R2 task sequence using 100% Powershell. 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 two of this post will demonstrate how I achieved this.