Write-Progress powershell command

Write-Progress | Taking on PowerShell one cmdlet at a time | Weekly Blog

Share this post:

This is a part of an on-going blog series written by Adam Gordon. Each week, Adam will walk you through a PowerShell command, showing you when and how to use each one. This week, Adam covers Write-Progress.

When to use Write-Progress

The Write-Progress cmdlet displays a progress bar in a PowerShell command window that depicts the status of a running command or script.

You can select the indicators that the bar reflects and the text that appears above and below the progress bar.

 

How to use Write-Progress

Display the progress of nested For loops:

 

This example displays the progress of two nested For loops, each of which is represented by a progress bar.

The Write-Progress command for the second progress bar includes the Id parameter that distinguishes it from the first progress bar. (Write-Progress -Id 1)

Without the Id parameter, the progress bars would be superimposed on each other instead of being displayed one below the other.

Write-Progress powershell command

 

Display the progress while searching for a string:

Write-Progress powershell command

Write-Progress powershell command

Write-Progress powershell command

Need PowerShell training? Check out ITProTV’s PowerShell online IT training courses.

Leave a Reply

Your email address will not be published. Required fields are marked *