🧬 WQL / PowerShell
Win32_PnPSignedDriver: Sorting Signed Drivers (WQL has no ORDER BY)
WQL has no ORDER BY clause — this shows the standard workaround of piping Get-CimInstance results through Sort-Object on Win32_PnPSignedDriver.
PnPSignedDriverSorted.ps1
<#
.SYNOPSIS
WQL reference: sorting Signed Drivers results (Win32_PnPSignedDriver).
.DESCRIPTION
WQL (the WMI Query Language) does not support an ORDER BY clause —
unlike regular SQL. Sort after the fact with Sort-Object instead;
this is one of the most common WQL gotchas for people coming from
SQL backgrounds.
.EXAMPLE
.\PnPSignedDriverSorted.ps1
#>
[CmdletBinding()]
param()
$wqlQuery = "SELECT DeviceName, DriverVersion, Manufacturer, DriverDate FROM Win32_PnPSignedDriver"
Get-CimInstance -Query $wqlQuery |
Sort-Object -Property DeviceName |
Format-Table -Property DeviceName, DriverVersion, Manufacturer, DriverDate -AutoSize