I’m not getting any errors or the sorts, more just looking for advice before I move on with my little project.
I have a dashboard that calls a script to performs some AD tasks. I wrote the below within the dashboard to update the end users of what the script is currently up to. I’m wondering if this is the best way to go about this or is there a more acceptable “PSU best practice.” for script progress?
I’m also a bit worried about the pipeline data building up as this could be run a lot. I won’t be able to discard the the pipeline from that script if I do the above right?
I did try that but I wasn’t able to get it to work. I was likely doing it wrong. I got it working but only using the job statues, not actually updating with what the job is currently doing. If that makes sense.
Bit confused how to use Write-Progress from within the job, not the dashboard I guess.
When you implement Write-Progress in your script, and invoke the job for that script from the dashboard with for instance a button, the dashboard will automatically show the values you’ve written in your Write-Progress.
It makes perfect sense (I was over thinking it) but I think this is exactly what I originally tried to do before I messed around for ages and posted here - haha.
Am I doing this right? I am not seeing any progress pop-up. I have tried a few other things before starting on what I originally posted here. Things like piping to Wait-PSUJob, Getting the job output with Get-PSUJob and I have confirmed that $ProgressPreference is set to Continue.
When I press the button, I am not getting any progress pop-up, but the job is starting and if I set -ShowLoading on the button it works as you’d expect.
Any help to point out what I’m doing wrong would be greatly appreciated!
Thanks!
I think, but am not 100% sure on it, but I think you’d have to do;
Invoke-PSUScript -Script 'TestScript.ps1' -Wait
Keep in mind that it does take a little while for the progress to actually show on the dashboard (from what I’ve experienced with it) so short jobs might be completed before it actually triggers?
Perhaps @adam is able to add some concrete information on this feature? As far as I’m aware, it’s not documented anywhere…
Your alterative solutions works (I should have paid closer attention to the attributes the job gives you haha, completely missed PercentComplete! ) so thanks heaps for the suggestion! I’ll use this if I can’t get the integration working!
However, even with the `Invoke-PSUScript -wait` I cannot see any of the interactive pop-ups. I left everything the same as the post above but just added the `-Wait` switch to the invoke command.
Important: I got it working before I posted the above. I’ll leave what I experienced just in case someone else finds themselves in the same spot.
I had two issues (At minimum): One being the -Wait was required by the looks of it but the second issue was that I had the script running under a different environment then the Dashboard. I tried setting them both to PS7 envi but no luck, it works when I set both the Dashboard and script to the Default envi or a PS5 envi.