Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

Out-GridView Now Has a PassThru Parameter

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!

5 responses to “Out-GridView Now Has a PassThru Parameter

  1. Rich Prescott September 19, 2011 at 8:12 pm

    Nice find Tome. I already know a few things I’ll be using this for.

  2. Jim Hofer (@ihunger) September 20, 2011 at 9:55 am

    Cool feature. Wonder where they got the idea … 🙂

    via –

    Automatic Code Generation

    Formatting results is a tedious task using traditional methods. PowerSE leverages it’s built-in data grid visualization to ease the pain. Simply rearranging the columns, removing unwanted data columns, and sorting. Then tell PowerSE to generate the PowerShell Script and you have created a nice report in minutes. In addition, a property grid allowing you to drill down into data structures, and generate the PowerShell script to retrieve the data you wanted.

  3. Pingback: Новинки PowerShell V3 часть 5 « Kazun

  4. Pingback: Summary of 2nd Dutch PowerShell User Group – DuPSUG meeting with additional resources |

  5. Pingback: Neue Features in PowerShell Version 3.0 – Beta - PowerShell Get-Script -Name Peter Kriegel | Management

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: