Exporting Out-GridView Content

by Feb 13, 2015

PowerShell 3.0 and later

Out-GridView is a very useful cmdlet to output results to an extra window. Unlike outputting to the console, Out-GridView will not cut off anything. And it has a not-so-obvious way of easily copying the information to other applications.

Try it! First, get some data, and pipe it to a grid view window:

PS> Get-Process | Out-GridView 

Next, optionally use the textbox on top to filter the results, or click column headers to sort.

Finally, to export the information elsewhere, for example to include a process list into a Word document, simply click anywhere inside the results, then press CTRL+A to select all, and CTRL+C to copy the selection to the clipboard.

From there, you simply paste it into the application of choice. Unfortunately, the column headers will not be copied.

Note that Out-GridView has an intrinsic limitation: it can only display a maximum of 30 properties (columns). So if your input data has more properties, you may want to limit them to the ones you really need:

PS> Get-Process | Select-Object -Property Name, Company, StartTime | Out-GridView   

Twitter This Tip! ReTweet this Tip!