If you live in a Group Policy world that heavily leverages WMI filters, then this tip is for you. Fellow Group Policy MVP Martin Binder wrote up a nice post about how you can optimize WMI filter queries (WQL queries) to improve their processing performance. This article uses a previously illustrated technique by another MVP, Mitch Tulloch, to show how WMI filter query performance can be improved by an order of magnitude. Basically, by not using the common “Select * From” syntax, in favor of specifying only those properties you really need to return, performance of many WMI filter queries improves greatly. An example of this is the following. Suppose you want to filter to evaluate to true if a particular Win32 Service was installed. Normally, you would do the following:
SELECT * FROM Win32_Service WHERE DisplayName = ‘MyService’
However, that query takes significantly longer to process than this following one, which, instead of asking for all properties, just asks for the one needed:
SELECT Name FROM Win32_Service WHERE Name= ‘MyService’
In the second case, instead of selecting the DisplayName property, I use a so-called “key property” (think of an indexed field in a database). When I use this keyed property, the results are significantly better.
Check out Martin’s post–I think it will be valuable advice for pretty much everyone using WMI filters–I know I plan to incorporate it into my best practices immediately!