Variables available within Automation Script

I can see with Get-Variable that I have some variables baked into my script:
parentJobId
UAJobId
UAScriptId

Do we have access to the environment that was used to execute the script?

You can use the $UAJob variable to get the environment.

$UAJob.Environment

Ah thanks. That must be a new one as it is not working in our 1.5.0 install. But I can see it on my local install.

Ah, yeah maybe. You can use Get-PSUJob -JobId $UAJobID to retrieve the same object in your job.

1 Like