views:

190

answers:

1

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?

+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
it doesn't work when you import module and module import issues Write-Progress
Vladimir Kocjancic
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