Find computers without a named application
A WQL collection query that returns computers that do not have a named application. It uses the "not in" subselect pattern.
LanguageWQL
What it does to the systemReads only. It changes nothing.
This query builds a device collection of computers that do not have one application. Use it to target the computers that still need an install.
A plain "not like" test does not work here. Every computer has other programs that pass the test. The "not in" subselect is the correct pattern.
WQL
select
SMS_R_System.ResourceId,
SMS_R_System.ResourceType,
SMS_R_System.Name,
SMS_R_System.SMSUniqueIdentifier,
SMS_R_System.ResourceDomainORWorkgroup,
SMS_R_System.Client
from SMS_R_System
where SMS_R_System.Client = 1
and SMS_R_System.ResourceId not in (
select SMS_G_System_ADD_REMOVE_PROGRAMS.ResourceID
from SMS_G_System_ADD_REMOVE_PROGRAMS
where SMS_G_System_ADD_REMOVE_PROGRAMS.DisplayName like "%7-Zip%"
)
and SMS_R_System.ResourceId not in (
select SMS_G_System_ADD_REMOVE_PROGRAMS_64.ResourceID
from SMS_G_System_ADD_REMOVE_PROGRAMS_64
where SMS_G_System_ADD_REMOVE_PROGRAMS_64.DisplayName like "%7-Zip%"
)
How to use it
- In the console, open Assets and Compliance, then Device Collections.
- Open the collection properties. On Membership Rules, select Add Rule, then Query Rule.
- Select Edit Query Statement, then Show Query Language. Paste the query.
- Change
%7-Zip%to your application name. Change it in both places. - Set a limiting collection, such as all workstations. This keeps servers out of the result.
Good to know
- A client that has not sent hardware inventory yet also shows in the result. SCCM has no program list for it.
- The line
SMS_R_System.Client = 1leaves out computers with no client. Remove it to include them.
missing software
not in
subselect
SMS_G_System_ADD_REMOVE_PROGRAMS