Verbose Driver Information

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

In a previous tip you discovered driverquery.exe to list driver information. This tool sports a /V switch for even more verbose information. However, due to localization errors, when you specify /V, column names may no longer be unique.

That's when you can reuse yet another tip we presented earlier and make sure CSV columns are unique:

function Show-DriverDialogVerbose {
    param(
        $ComputerName = $env:computername
    )
    
    function Convert-Unique($list) {
    $list | Group-Object |
        ForEach-Object {
            $_.Group | ForEach-Object { $i=0 } { $i++
                    if ($i -gt 1) { $_ += $i } $_ }
        }
  }

    driverquery.exe /V /S $ComputerName /FO CSV |
        ForEach-Object {$i=0}{ $i++
            if ($i -eq 1) {
                """$((Convert-Unique ($_.Replace('"','').Split(',') )) -join '","')"""
            } $_
        } | 
      ConvertFrom-Csv | 
      Out-GridView -Title "Driver on \\$ComputerName"
}

Twitter This Tip! ReTweet this Tip!


Posted Apr 10 2012, 06:00 AM by ps1
Copyright 2012 PowerShell.com. All rights reserved.