Tag Archives: write-progress

For whatever reason, I had a really difficult time wrapping my head around the usage of Write-Progress. The basic usage is off-course quite easy: Write-Progress -Activity “Something” -Status “Something else” -CurrentOperation “thinking” -PercentComplete 30 This will show a quick progress bar stating that “Something” is going on, the status is “Something else” and it has gotten to 30%. However, when I wanted to use Write-Progress in a large script I quickly got confused when I looked at some of the examples out there. I mean, look at this for example: $wmiQuery = “Select name from win32_service where state = ‘running'” $colItems = Get-WmiObject -Query $wmiQuery For($i = 1; $i -le $colItems.count; $i++) { Write-Progress -Activity “Gathering Services” -status “Found Service $i” ` -percentComplete ($i / $colItems.count*100)} $colItems | Select name I’m sure that if I had a stronger background in programming and/or scripting I could have figured it out quite…

Read more