Out-GridView Now Has a PassThru Parameter
September 19, 2011
Posted by on
So CTP 1 for PowerShell v3 was released. Go get it now. I will use another hash tag for this called v3CTP1 so that I can quickly fix these posts when I go back after V3 is RTM.
So, with so much to talk about, I’m going to show something simple that I think is madly madly cool! Out-GridView now has a PassThru parameter. What does it mean, what does it mean?
Try the following:
Get-Process |Out-GridView -PassThru |Select Name
You’ll see your normal Out-GridView, but you’ll also see an OK and Cancel button int he bottom right.
What does it mean?
Filter the contents of the gridview to display things you are interested in, then click on a few rows. When you have selected a few, click OK! You have just passed the objects that you are interested in through the pipeline to the next cmdet which happens to be Select Name. What an amazing cmdlet! The ability to have the operator of your script use the filtering and sorting of Out-GridView to choose data that should be processed!