I have a PowerShell script that calls a CmdLet which in turn reports its progress using Write-Progress, and I would like to hide the progress bar.
In is it possible to suppress or redirect the output of the Write-Progress CmdLet?
views:
190answers:
1
+5
A:
Try setting this preference variable before calling the cmdlet that utilizes Write-Progress:
$ProgressPreference = 'SilentlyContinue'
You may want to revert back to 'Continue' afterwards.
Keith Hill
2009-12-18 15:15:42
it doesn't work when you import module and module import issues Write-Progress
Vladimir Kocjancic
2010-08-09 13:28:32
Must be a little more to it because it does suppress it in this case: $ProgressPreference = 'SilentlyContinue'; new-module -ScriptBlock { for ($i=0;$i -lt 100; $i += 5) { Write-Progress act stat -perc $i; Start-Sleep -milli 500 }} -pass | ipmo
Keith Hill
2010-08-09 14:38:42