Send PowerShell Output to an Interactive Table

Out-GridView
Out-GridView

When you think about Windows PowerShell, you will mostly imagine a console-based graphical user interface that might seem overwhelming to some. However, PowerShell 2.0 introduced a new cmdlet that sends output to an interactive graphical user interface that is easy on the eyes.

Details

The Out-GridView cmdlet sends output to an interactive table in a separate window.  Since this cmdlet requires a user interface it does not work on Server Core installation of Windows Server.  You can Hide, Show and Reorder columns in the output table (right-click and choose Select Columns).  You can also sort columns by just clicking on the column headers (keep clicking to toggle between ascending and descending).  There is also a Quick Filter which allows you to search for text in a column, search for literals and search for multiple words.  The Criteria Filter is very useful for very large sets of data (use the Add criteria drop-down menu).  Lastly, you can Copy and Paste from the the Out-GridView using keyboard shortcut keys CTRL+C.  You will be able to paste the copied date into any text or spreadsheet program.  You can also type Get-Help Out-GridView -Full to get detailed instructions on using this cmdlet.

I find this command useful when the result I am expecting back from a cmdlet is very large to review in the PowerShell window where you would otherwise output to a CSV file.  Using this allows you to quickly visualize the resulting data, filter, sort and then copy and paste a narrowed down version of the result to your final output method.  I personally find this command very useful in my day-to-day tasks related to Microsoft Office 365 tenant administration, Active Directory reporting and just basic system commands using PowerShell.

Syntax

Parameter Set: PassThru
Out-GridView [-InputObject (PSObject)] [-PassThru] [-Title (String)] [CommonParameters]

Parameter Set: OutputMode
Out-GridView [-InputObject (PSObject)] [-OutputMode  {None | Single | Multiple} ] [-Title (String)] [CommonParameters]

Parameter Set: Wait
Out-GridView [-InputObject (PSObject)] [-Title (String)] [-Wait] [CommonParameters]

Examples

Example 1

Gets the currently running processes on the local computer and sends it to a grid view window.

Get-Process | Out-GridView

Example 2

Gets the currently running processes on the local computer and sends selected fields (columns) to a grid view window while also sorting by a selected column.

Get-Process | Select-Object -Property Name, WorkingSet | Sort-Object -Property WorkingSet -Descending | Out-GridView

This cmdlet has a lot of uses and I would love to see how you are making use of it.  Please feel free to add your use case below in the comment section to share with everyone.

 

About Vikram 7 Articles
I am just an IT person trying to share as much knowledge as possible hoping someone will find it helpful. It just takes time to organize everything from my head into something that makes sense.