Rem: Sorting Data Returned from WMI’s ExecQuery Method

Although WQL doesn’t support sorting, you can use an ADO disconnected recordset to sort the data.

Bob Wells

August 10, 2003

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Can I use the WMI Query Language (WQL) to sort the data that the Windows Management Instrumentation (WMI) Scripting Library's ExecQuery method returns, or must I use my own sort routine?

WQL doesn't support sorting. However, you don't have to create a routine from scratch. Instead, you can use an ActiveX Data Objects (ADO) disconnected Recordset to sort the data that your WMI query returns. The Microsoft Windows 2000 Scripting Guide includes an excellent step-by-step discussion and sample script about this subject. See the topic titled "Sorting Data by Using a Disconnected Recordset," which you can access through the Microsoft TechNet Script Center portal at http://www.microsoft.com/technet/scriptcenter/scrguide/sas_ent_piij.asp?frame=true.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like