Tome's Land of IT

IT Notes from the Powertoe – Tome Tanasovski

Out-GridView – OGV

This is one of the neatest cmdlets I’ve found.  It is a great way to output lists very easily so you can filter, sort, and copy the contents to your clipboard.  The cmdlet is Out-GridView and has an alias of ogv.

dir |ogv
get-Process |ogv
dir |ogvget-Process |ogv

Here’s what the output for get-process looks like in ogv:

  • The filter box gives you a quick way to find text within all of the fields
  • Criteria gives you a way to filter on specific columns and use logic like greater than or contains
  • The columns are sortable by a single click
  • If you right click on the columns you can hide columns
  • The columns can be reordered by dragging a column left or right
  • You can select all or individual rows and copy and paste the contents into a text editor or excel

In addition you can use select-Object to immediately filter and order columns before it gets into the GridView:

dir |select-Object Name, LastWriteTime |ogv

As you can see this is a powerful and useful little cmdlet that should definitely remain in your Powershell utility belt.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: