Send Variable to SCCM Task Sequence

In this example, we launch the command cctk.exe –tpm

If the result is equal to “tpm=on”, $TPMvalue variable is set to “on”, else $TPMvalue variable is set to “off”

tpm variable is send to the task sequence with the value of $TPMvalue

To retrieve the information in the Task Sequence, use the variable “tpm” (value must be “on” or “off”)

$EXE = 'C:\cctk.exe'
$ARG = '--tpm'

If ($RETURNVAL -eq "tpm=on") {
    $TPMvalue = "on"
Else {
    $TPMvalue = "off"

$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$tsenv.Value("tpm") = $TPMvalue