Last updated on August 7th, 2022 at 09:32 pm
You know I always like to help those who try to help themselves. While reading Reddit post entitled SCCM Collection missing machines… the person was looking for all computers that follow a particular naming convention. Their results were not that they expected. This blog will show you how to solve this problems step by step by show you How to Write a WQL Query.
For Microsoft Endpoint Configuration Manager (MEMCM / MECM / SCCM / ConfigMgr) administrator, the life blood is creating collections. But understating how they work isn’t always obvious. Using the Reddit example WQL Query is listed below.
Original WQL Query
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 inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_COMPUTER_SYSTEM.Name like "%CTM-SG%"
Now this is nothing wrong with this query, per se. What is note worthy aboout this query is that it is joined on SMS_G_System_COMPUTER_SYSTEM. This means that the MECM client MUST be installed and that the Hardware inventory is working for this device. If the device doesn’t have the MECM client installed. Or that Hardware inventory isn’t working then the devices will NOT show up within the collection.
Consequently, based on what was posted there are two wildly different solutions. First one suggests was to adjust the WQL query to remove the SMS_G_System_COMPUTER_SYSTEM view and therefore as long as the device is discovered by AD, it would show up within the collection.
Second solution is to troubleshoot Hardware inventory.
Troubleshoot ConfigMgr Hardware Inventory
This is the second solutions, since I have already published blog on how to Troubleshoot ConfigMgr Hardware Inventory. I thought that I would put it first.
Write a WQL Query
We can adjust this query to only use discovery data. To help with this I have created a video with the steps. The import thing to note is that you generally do not limit to the All Systems Collection. Instead limit to the All Desktops and Server collection.