Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » Write-Progress

Write-Progress - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »

Write-Progress

Description
Display a progress bar

Usage


Options


Example(s)
Display progress of a for loop:

PS C:\>for($i = 1; $i -lt 101; $i++ ) {for($j=0;$j -lt 10000;$j++) {} write-progress "Search in Progress" "% Complete:" -perc $i;}

Display progress while searching through the system event log messages:

PS C:\>$events = get-eventlog -logname system
PS C:\>$events | foreach-object -begin {clear-host;$i=0;$out=""} -process {if($_.message -like "*bios*") {$out=$out + $_.Message}; $i = $i+1; write-progress -activity "Searching Events" -status "Progress:" -percentcomplete ($i/$events.count*100)} -end {$out}