Write-Progress
Use Write-Progress to show a progress bar with a percentage, status text, and time remaining while a loop or long task runs.
Documentation: Microsoft Learn — write-progress
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Show progress inside a loop
Show reference output
Illustrative output · values vary by environment
Processing records [ooooooooooooooooooooooooooooooooooooo ] 75%
Show nested progress with parent and child bars
Show reference output
Illustrative output · values vary by environment
Migrating servers [██████████████░░░░░░░░░░░░░░░░░░░░] 40% Server 4 of 10 [████████████████████░░░░░░░░░░░░] 60%
Close the bar when finished
Show reference output
Illustrative output · values vary by environment
(progress bar disappears)
Parameters
Parameter definitions:
-Activity— The title of the operation shown above the bar.-Status— A short line under the title, such as 'File 12 of 40'.-PercentComplete— A number from 0 to 100 that fills the bar.-CurrentOperation— A detail line for the item currently being processed.-SecondsRemaining— Estimated seconds left, shown next to the bar.-Id / -ParentId— Ids that let a child bar nest under a parent bar.-Completed— Closes the bar. Always call it when the task finishes, or the bar stays on screen.
Always close the bar, and do not update it every millisecond
A progress bar left open by a finished script stays on screen and confuses the next command's output. End every Write-Progress loop with Write-Progress -Activity ... -Completed, even on error paths.
Updating the bar on every iteration of a fast loop slows the loop down, because rendering is expensive. Update every 10th or 100th item, or only when the percentage actually changes.
Percentages must be integers from 0 to 100. Compute them as [int](($i / $total) * 100) and guard against division by zero when the collection is empty.
Pause between steps with Start-Sleep
Write status lines with Write-Host
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
Write-Progress Use Write-Progress to show a progress bar with a percentage, status text, and time remaining while a loop or long task runs.
Next: Select String