Use Write-Progress to Return Feedback

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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 PowerShell.com. All rights reserved.