Progress Bar in Powershell

In your long running powershell scripts it would be useful to be able to add a progress bar to update on the progress of the script. It is simple to add a progress bar in powershell, you just need to use the Write-Progress cmdlet. This cmdlet allows you to pass in a few parameters to report the activity, and the current status of the activity. The following example shows how:

The result looks like the following in powershell:

Progress Bar in Powershell
Progress Bar in Powershell

The Write-Progress cmdlet takes several parameters:

  • -activity: the title of the activity you are performing
  • -status: a string detailing the current status of the activity
  • -percentcomplete: the current percentage complete of the activity

There are a number of other parameters you can pass in for more complex procedures. See the post on Write-Host on technet for more details.

For more powershell tips, see my post on allowing parameters to be passed to a powershell script


Leave a Reply