SCCM Task Sequence Variables

With the following ComObjects you can easily read/ write and create task sequence variables.

To use TS variables in a powershell script use the following lines of code;

To initialize the ComObject while in TS:

To display a TS variable value use:

To write a value to a TS variable use :

Source information was found from here.