Show user progress updates on a script

I have a single PowerShell script that I want to let a user run by clicking a button. This script takes awhile to run, and I’d like to provide feedback to the user. I have seen other examples in the forums of people providing updates but only if the tasks are broken down into steps, so progress information can be updated (e.g. in a UDDynamic) between the steps.

Is there a way I could provide user feedback on the live script? Ideally I’d be able to capture what’s coming off one out the output streams and display it to the user. The Progress stream or the Success (Write-Output) stream would do.

Thanks,
Eric

Product: PowerShell Universal
Version: 2.3.2

I’ve seen something like this around here before.
I believe it used dynamic region with then code-editor inside of it. Not sure how it exactly was parsing the output stream but perhaps if we search the forum together we can find it haha

This might be what you are looking for;

Thanks! That is close. I see that it’s using a UAJob to actually run the script. Which I could do, but I was hoping I could avoid that complexity and directly call a command in my dashboard.

I do see how this could be a difficult request, though - the command would have control of the session until it completes. So maybe it’s unavoidable that I run it in a UAJob, or maybe in a regular PS Job. Perhaps I could use a while loop with Receive-Job inside to get output and add it to a code window.

Put a feature req on GitHub for this on powershell universal and see what @Adam think how he can simplify this. I can bee wrong here but I think that @Adam has does this easier in 2.4.0 But I might bee wrong as I can’t remember it completely.