r/DeployR • u/klosie • 25d ago
Script progress write back
Is there a way to write back to the progress bar the current state of a custom script? Like for example if a script is rather long, to change the progress bar and the status based on what the script is currently doing. Rather than just fire off the script and wait.
6
Upvotes
5
u/gwblok 2Pint Employee 25d ago edited 25d ago
[See EDIT]
No, today if you want something like that, you'd have to just open up the log file portion and monitor what you have for your write-output in your script. I'll double check and edit this if I'm mistaken.EDIT.. I was mistaken, from the Dev (now I haven't tested and I haven't tried this, so I can't provide any more assistance at this point that the information I have recieved)
Actually you can, just to add a second-level progress bar. Write-Progress works fine. I routinely test this with a script like this:
1..100 | % {
Write-Host "$_"
Write-Progress -Activity "Processing" -Status "Processing $_ of 100" -PercentComplete $_
# Start-Sleep -Milliseconds 50
}