Is it possible to access the username of the user that is initiating a script? I had a look at the Variables document but didn’t see this specifically. In this scenario I’d like to automatically capture this information when a user runs a script, and output it in the script output. I know how to access the account which initiated a script job but if possible I’d like to capture the data earlier within the script itself as the script produces an output log to a third party system.
When you run a script there is a variable thats injected into the environment $UAJob
This represents the Job that is running in PSU - $UAJob.Id is the reference number of the job and part of the url and other properties are there as well
eg a script with this block will get you the user that initiated the script from PSU