Use Write-Progress to Return Feedback

Share |

Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus

13 Free SQL Tools from Idera

Free Ebook: Mastering Powershell

Some operations will take more time so it is a good idea to return feedback. Write-Progress can do just that. Go ahead and add a Foreach-Object to your pipeline, update the progress information with it, and remember to return the data received by Foreach-Object to the following pipeline command:

Dir $env:windir *.log -recurse -ea SilentlyContinue |
Foreach-Object { Write-Progress "Collecting..." $_; $_ } |
Sort-Object Length

Twitter This Tip! ReTweet this Tip!

Posted Apr 30 2010, 08:00 AM by ps1
Copyright 2012 All rights reserved.