DEV Community

Antonio Di Motta
Antonio Di Motta

Posted on

Managing Powershell collections graphically

One of the most interesting features of Powershell is manipulation of data as object collections, which is a feature inherited from the .net platform.

A collection (eg array) can be the result of powershell command and it could contain a lot of objects but only a subset of them could be interesting. To facilitate the selection of data subset, exists a Powershell Cmdlet console-based GUI called Out-ConsoleGridView.

# installation
Install-Module Microsoft.PowerShell.ConsoleGuiTools

# usage example1:
PS C:\> Get-Process | Out-ConsoleGridView
Enter fullscreen mode Exit fullscreen mode

Image description

As you can see the tool is always integrated into the terminal because it has built on a cross platform UI toolkit based on a fantastic open source project called Terminal.Gui. Now you can select the objects by using space bar and than confirm the selection with enter.
The result will be:
Image description

As you noted the result its still a collection so we can use it by pipe with another Powershell command:

# usage example2:
PS C:\> Get-Process | Out-ConsoleGridView | Export-Csv -Path .\ProcessLog.csv
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<