Hi All,
one of the most useful tips I've learnt on the job is to use WBEMTEST on your Primary Site Server to test your Collection WQL queries. This is useful for doing things like testing the time it takes to run that query. This is especially useful when you get collections that take a very long time to run potentially causing backlogs and delays in collections updating. Using these tools can help you quickly test the queries for timing outside of Configuration Manager.
WBEMTEST
Log onto your Site Server or from your tools machine you can connect remotely. Ill show you both methods.
Start up WBEMTEST from a command line
Click Connect
In Namespace type in the following
root\SMS\SITE_XXX
replace XXX with your SiteCode
If your connecting remotely
\\Computername\root\SMS\SITE_XXX
then click Connect
Click the Query button
Enter your WQL query and click Apply
If you have a valid query you should see a result
PowerShell
You could also run a similar query using PowerShell (Thanks to my fellow PFE’s Ryan Hall and Anthony Watherston for this.)
just replace the value in the $WQL variable quotes with your query and of course PRI with your SiteCode.
$WQL = 'select * from SMS_R_SYSTEM'
$WMI = Get-WmiObject -Namespace Root\SMS\Site_PRI -Query $WQL
$WMI
and if I want to measure that command for approximate timing
Measure-Command -Expression {Get-WmiObject -Namespace Root\SMS\Site_PRI -Query 'select * from SMS_R_SYSTEM' }