Best way to execute long running script from a dashboard?

I have a long running script that requires input from a UDStepper.

What’s the best way to start this script once I have the parameters from the user?

Ideally I would like to redirect the user to the script added in the Automation section as you can see the script output (I’ve setup logging with Start-Transcript with many Write-Information calls) Errors and progress are clearly visible.

Can I pass the parameters I collected in UD-Stepper to the script which is part of automation?

Are there other ways to do this?

You can pass parameters to scripts. Invoke-UAScript uses dynamic parameters to add those values. For example, if you had a script like this:

param($MyValue1, $MyValue2)

From your dashboard, you could call it like this:

Invoke-UAScript -Name 'MyScript.ps1' -MyValue2 'Nice' -MyValue1 'Cool'

Invoke-UAScript will return a Job object that contains an ID that you could then use with Invoke-UDRedirect to forward the user to the job.

1 Like

OK thank you, this works. I had to specify parameters ‘computername’ and ‘apptoken’.
Computername being the full url including https, fqdn and port. Also an apptoken. (I have a setup with ws-fed sso on adfs)

It would be nice to have this type of script execution without giving the user access to the admin section. However most ‘users’ are technical IT crew members so it’s not really an issue.

Not complaining, very good solution for the time being. Thanks!

We’ve considered having a more “dashboard-style” view for operators without all the options of the admin console. The other thing that we’ve talked about is having Automation-based controls for UD so you could plop a “Job Component” on the dashboard and have it integrated right along side your other components.

Always open to suggestions.

1 Like

+1 for the ability to plop a “Job Component” on the dashboard :slight_smile:

This would allow for very quick onboarding of existing scripts that often use write-host and read-input. (or write-information, write warning etc)

Then gradually we can migrate those read-host imputs to proper dashboard GUI inputs like forms and steppers.