I think Write-Progress is a rather beautiful Cmdlet. In fact Sharepoint makes use of it with its Start-SPAdminJob commandlet.
All fine and dandy, the problem is that Start-SPAdminJob does not correctly "dispose" of the Write-Progress dialog. It is never set to 100 percent complete which means it just stays in the Powershell dialog until you exit the script - this in turn hides part of the messages underneath the "progress window".
Is there any way I can force an existing Write-Progress
to "exit" or be set to 100% complete? Any way how I could find out the ID of the progress the Start-SPAdminJob
cmdlet is using - that way I could manually set the percentage.
You could stop the progress bar appearing in the first place by doing the following beforehand:
$ProgressPreference = "SilentlyContinue";
You could then restore the preference to "Continue" afterwards. Not much help if you actually want the bar of course...
This code forces progress bar to be set to 100% complete and hides it:
Write-Progress "Done" "Done" -completed
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With