Powershell adTempus Job/Step values

Ken T (33 posts)
February 23, 2023 11:02 AM
Accepted Answer

Hi Bill,

I'm trying to output the adTempus values via Powershell script. Unfortunately, the adTempus values are showing as zeros.

How do I change my script to output the values?

$adTempus.LogMessage([ArcanaDevelopment.adTempus.ApplicationIntegration.MessageTypeEnum]::Informational, 0, "Windows ProcessID: $PID, adTempus Job Instance ID: $($adTempus.JobInstanceID),  adTempus Job ID: $($adTempus.JobID), adTempus Step ID: $($adTempus.StepID)")

Write-Host "adTempus.JobInstanceID: $($adTempus.JobInstanceID)"
Write-Host "adTempus.JobID: $($adTempus.JobID)"
Write-Host "adTempus.StepID: $($adTempus.StepID)"

Bill Staff (604 posts)
February 27, 2023 10:31 AM
Accepted Answer

It looks like maybe there is a bug and those properties aren't being set for PowerShell scripts. We will look into this. You can use the equivalent Job Variables instead:

  • JobID: $adTempus.JobVariables["ADTJobID"]
  • JobInstanceID: $adTempus.JobVariables["ADJobInstance"]
  • StepID: $adTempus.JobVariables["ADTJobStep"]

You can find the list of variables here.

Note that the properties and variables will return empty if you test the script from the Script Editor, because they are only set when the job is executing.