out-gridview

out-gridview

  • Comments 16

One of the new feature areas for PowerShell V2 CTP is support for rich output.  The out-gridview cmdlet allows you to send the output of any PowerShell command into a fully interactive grid window.  This feature is available from standard PowerShell and Graphical PowerShell.  Out-GridView can be very useful if the output of your command is long or you need to perform a deeper analysis on that data. 

Here is an example of how to use the out-gridview to display the running processes.  Out-GridView also supports the following aliases grid and ogv

clip_image002[4]

After issuing the command, a new window will appear that contains a grid that has been populated with the data from the pipeline.  This window is separate from the main PowerShell window.  You can go back to PowerShell and issue different commands or even create new grid windows.  However, if you close PowerShell – then all grid windows will also be closed.

The search feature makes it easy to quickly find a specific piece of data.  Here are a few details on how the search mechanism works:

· Searches across all columns and rows

· Search on a single column with this syntax <columnName>:searchValue  

· Matching is not case-sensitive

· Search will match any part of a value

· If the search text is enclosed in quotes – the search should only find items that have the exact phrase.

· May search on more than 1 word –search should treat it like there is a AND between the words.  In other words – it should find rows that have word a AND word b

· Special characters like punctuation, semi-colons, colons, brackets, less than, greater than, brackets, braces are NOT ignored. 

The following example demonstrates searching the application log for entries containing “SQL”.  Any entries that don’t contain that text are no longer in the list.  To get the grid to display all of the entries again erase the text in the search area.

clip_image004[6]

The grid allows sorting by any column –clicking on the column header for a column then the grid will be sorted by that column in ascending order.  Clicking again on the same column then the sort direction will be reversed (descending). 

clip_image006[4]

Grouping is a useful technique to better help visually organize your data.  To turn grouping on right-click anywhere in the column headers and select “Show in Groups” to toggle that feature on.   When you click on one of the column headers the grid will group by that column.  The following example demonstrates grouping a list of services by the status column.  The items under each grouping may be hidden or shown by selecting the arrow next to each grouping.  All  groupings are expanded (shown) by default.  It is also possible to reverse the sort direction of the groups by clicking the column in the header.

clip_image008[4]

Please send feedback to gPSfeedback@microsoft.com

Thanks,

Brent Taft [MSFT]

Senior Program Manager

Leave a Comment
  • Please add 1 and 2 and type the answer here:
  • Post
  • @mihi

    use Select:

    ps |select id,processname,@{name="ThreadCount";expression={$_.Threads.Count}} |ogv

    jps

Page 2 of 2 (16 items) 12