How to Create a Prompted Query (WQL)
By Garth Jones
Not too long ago, I answered a question within the ConfigMgr 2012 forums about why a prompted query wasn’t working. This led me to write a blog post about how to create a prompted query.
Creating a prompted query (or WQL) is similar to creating any other query, so I won’t provide every step, only the basics.
NOTE: I’m using ConfigMgr 2012 in my example, but the steps are basically the same for 2007 and 2016.
1. Open the ConfigMgr 2012 console and browse to Monitoring | Queries. Next, click on the Create Query button.
2. Provide a Name for your query and then click on Edit Query Statement…
3. Select the displayed columns that you want to see. Next, click on the Criteria tab.
5. Change the Criterion Type to Prompted value from the drop-down box.
Now, finish creating the query as you would any other query, but before clicking on OK take a look at the next screenshot to make sure your results are similar.
6. When you are finished adding the Prompted value criteria, it should look similar to the screenshot above. Now, click OK.
The final query (watch for word wrapping) will look like this:
SMS_R_System.OperatingSystemNameandVersion like #PRM:SMS_R_System.OperatingSystemNameandVersion##
7. When you run the query you will be prompted for a value.
Note: Make sure to include the “%” sign when using a Like as your operator within the query.
8. Finally, this is what the results of your query should look like.
If you have any questions, please send me a tweet @GarthMJ.