how to convert WQL to SQL for a SCCM or sms query

smsprov.log - records WMI provider access to the site database

this is a server log and can be found from the site server:

open smsprov.log
excute your query
you should be able to see the query execution logged in the smsprov.log. Once this has happened, pause the log file so it does not scroll away on you.
look for the two lines starting with execute wql= and execute sql=,
copy the text out of the bottom pane of the log viewer and paste it into your web report.

1 comment:

Brothertu said...

This SQL Query can be used to see how WQL is converted to SQL by SMS for collections.

, Collections.CollectionName
, Collection_Rules.QueryName
, Collection_Rules_SQL.WQL
, Collection_Rules_SQL.SQL

From Collections,Collection_Rules, Collection_Rules_SQL
Collections.CollectionID = Collection_Rules.CollectionID
AND Collections.CollectionID = Collection_Rules_SQL.CollectionID