Reading & writing custom vars using powershell in a SCCM task sequence – Part 1

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:

  1. About Task Sequence Variables
  2. Task Sequence Built-In Variables
  3. 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:

SCCM TS Registry results


Part two of this post will demonstrate how I achieved this.

Be the first to comment

Leave a Reply