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 7 and 2 and type the answer here:
  • Post
  • "One of the new feature areas for PowerShell V2 CTP is support for rich output."

    Great way to make composable functionality combining the power of a command line with the usability of a GUI.  NICE!

  • I remember one of the concerns with having plural/singular forms of names in PowerShell was that the ambiguity might make it harder to memorize commands in environments where IntelliSense-ish features couldn't be implemented, for instance in command-line only OS'.

    Has that concern been forgotten?

  • I see no plural commands shown. Are you referring to gps? It's an alias for the Get-Process cmdlet.

  • Updated Windows PowerShell Help topics are now live in the TechNet library at http://technet.microsoft.com/en-us/library/bb978526.aspx

  • Now PowerShell is the tool I have been looking for years... Fantastic work guys!!!

  • Actually I'm referring to the reasoning for the lack of plurals: http://blogs.msdn.com/powershell/archive/2006/07/23/Issues-with-Windows-PowerShell-syntax.aspx

  • Why don't you just make PowerShell itself into a graphical command line? Just because it's a command line doesn't mean it can't contain graphics.

    Instead of putting the table in a separate window, put it on the main window, replacing the traditional text-based table. And allow the user to type in a proportional font. In the future you could even allow grid cells to contain custom fonts or graphics. Think about it.

  • Tak się dalej bawię nowym Powershellem i dokonuję kolejnych odkryć. W nocy wspomniałem, że Windows Powershell

  • I've been doing a lot with out-gridview lately. It seems that memory consumption in the powershell.exe process goes up each time out-gridview executes, and I haven't found a way to free this memory.  Anyone else experience this, or know of a way to release the memory?  I've tried using [GC]::Collect(), but didn't seem to make an difference.

  • PowerShell is hosted in our .NET smart client app. Is there a way to embed the Out-GridView's popup control in our WinForm?

  • Is there a way to remove the limit on the number of columns displayed with out-gridview?

  • Is there a way to wordwrap the contents in a column?

    Seems to me out-gridview is complete other than that (v2ctp3) - if its not currently possible, hopefully this can be added as a feature request for the next release    ;-)

  • It has been more than one year since we updated Out-GridView feature with you. In case you are not familiar

  • Can you save the output to reopen the grid?  Also can you copy the data to paste into Excel?

    Thanks!

  • And how can I change the columns that are output (i. e. add columns, not remove some?)

    ps | ft Id,ProcessName,{$_.Threads.Count} | ogv

    does not work, unfortunately...

Page 1 of 2 (16 items) 12