Using List View in a Grid View Window (Part 2)

by Jan 24, 2018

Out-GridView is a useful cmdlet to list many objects. It is not ideal when you just want to display a single object with all of its properties, because in this scenario there would only be one line. In the previous tip we explained how turning an object to a hash table can help. It effectively puts the grid view in “ListView” mode.

Because this approach can be highly useful in many scenarios, here is a function called ConvertObject-ToHashTable, along with a bunch of examples:

function ConvertObject-ToHashTable
    $object | 
        Get-Member -MemberType *Property | 
        Select-Object -ExpandProperty Name |
        Sort-Object |
        ForEach-Object { [PSCustomObject]@{ 
            Item = $_
            Value = $object.$_} 
systeminfo.exe /FO CSV | ConvertFrom-Csv | ConvertObject-ToHashTable | Out-GridView
Get-ComputerInfo | ConvertObject-ToHashTable | Out-GridView
Get-WmiObject -Class Win32_BIOS | ConvertObject-ToHashTable | Out-GridView

Are you an experienced professional PowerShell user? Then learning from default course work isn’t your thing. Consider learning the tricks of the trade from one another! Meet the most creative and sophisticated fellow PowerShellers, along with Microsoft PowerShell team members and PowerShell inventor Jeffrey Snover. Attend this year’s PowerShell Conference EU, taking place April 17-20 in Hanover, Germany, for the leading edge. 35 international top speakers, 80 sessions, and security workshops are waiting for you, including two exciting evening events. The conference is limited to 300 delegates. More details at

Twitter This Tip! ReTweet this Tip!