Running scripts from the Dashboard

I have a script running under Automation that works great. (Note: this script makes use of a secret variable.) However, I wanted to provide some more graphical features (e.g. parameter selection via searchable table) than Automation provides, so I set up a Dashboard to collect the parameters. I’m wondering what my options are for running this script.

It would be great if I could simply call it from the Dashboard, wait for the results, and display any feedback. I tried Invoke-UAScript in the -onlick parameter of a button, but nothing happens. Is that even a valid approach?

Should I just put the code directly into the dashboard? But if so, how do I deal with the secret variable?

Thanks,
Eric

Product: PowerShell Universal
Version: 1.5.3

Yep. That’s a valid approach. Here on some docs on how to invoke the script and wait for results: https://docs.ironmansoftware.com/automation/jobs#invoking-jobs-from-powershell

The secret variable should still be loaded when using Invoke-UAScript. You should be able to check in the Dashboard log to see if there are any errors that are preventing the script from starting.

Likely the problem is that the dashboard doesn’t have an app token. I’d create an App Token, put it in a secret and then the dashboard will load that app token and you can use it. Use Connect-PSUServer to set the app token and API URL in the dashboard.

I’d like to report that your suggestion was exactly correct - I needed an app token. I set it up according to your instructions and everything is working.

Also wanted to say, thanks for making a great product and for being so responsive to questions and suggestions!

-Eric

1 Like