Pass Squaredup Username to script

Is the a way to pass the current logged in username to a PowerShell script or SCOM Task?

As in, the user running the script/task? or all logged in users?

I want to pass the SquaredUp username of the one triggering the script/task in Squareup.

Interesting - I’m checking with some colleagues to see if this is possible.

Are you able to share your use case?

The are a couple uses.
One is for logging. So the script that runs on a server can add the username to the local log.
The other would be to allow personalised tiles. Like run against AD and display the users accounts info.

Any update from your side? It will be grateful. Or maybe is it possible get username from active session in brackets {{}} as variable ?

Hi

@mad - I’m happy for someone to correct me but I don’t see a way to get the information into the PowerShell script from the Task.

  • The information about who submitted the task is in the SCOM console under tasks but that doesn’t help you when you want it in the script to output that information to a log file.
  • You can use whoami in the script but that only shows the user context that the script is executing under which will either be the pre-defined run as account (the agent action account) or the user name that the task was executed under. This may or may not be the user that is logged into windows which may or may not be the user that is logged into the SCOM console.

Running task with “Use the predefined Run As Account” selected.

Running the task with a User specified (but not the user logged into windows or the SCOM console).

If anyone can let me know if they have a way of passing the windows or scom logged in user to a powershell script that is being executed as a task then please reply to the thread and I can update.

@KamilAdamczyk - Some information is logged to the Audit database if it is configured but we only “audit” dashboard use (and this requires an EAM license). We don’t capture task usage or expose a way to get the logged in user (however we define that) into a script.

EDIT

If you’d like to DM me, we can discuss what your underlying aims are and create an enhancement request. It should be possible to capture this information when users execute SCOM tasks from SquaredUp but if you are doing this for security purposes then users can bypass anything we do via the SquaredUp portal by using the SCOM console directly.

Regards

Graham