Skip navigation

Rem: Sorting Data Returned from WMI’s ExecQuery Method

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

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.