Aside of static direct memberships in collections, a far more interesting and flexible way is using query memberships. In my company we have around 22000 workstations and distribute all updates in a phased way.
One way to achieve this would be to use MAC-address trailing characters, but then again, this won’t work for every situation. Another way to do this is to use the trailing character of the so-called ‘SCCM Agent ID’. This ID is generated upon installation of the SCCM agent on a machine, thus, all clients and servers that get SCCM agents installed upon them, will have a unique value.
Similar to MAC-addresses, they’re hexadecimal, however MAC-addresses have a certain lifetime. For example, in a company a common machine lifetime would be 2 to 3 years. After that, machines are replaced by new ones, thus new MAC-addresses will become available to SCCM. The thing is you’re always dependant on manufacturers’ naming convention when it comes to physical address based filtering. Using the SCCM Agent ID’s, you don’t have this problem and this is valuable when creating several even-sized system queries. SCCM Agent ID balancing will follow the number schema below:
GUID:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Every x represents a hexadecimal value, we’re only interested in the last value in the string, this can, as all other x’s have a value of 0-9 or A-F, giving us 16 possibilities per character. As a WQL query, this converts to:
SELECT SysG.Name, sysR.SMSUniqueIdentifier
FROM SMS_R_System AS sysR
INNER JOIN SMS_G_System_SYSTEM AS SysG ON SysG.ResourceID = sysR.ResourceId
WHERE sysR.SMSUniqueIdentifier LIKE "%0" OR sysR.SMSUniqueIdentifier LIKE "%1"Result of this query is a number of machines ending whoms SCCM Agent ID ends with 0 or 1. Duplicate this query 8 times to get a full coverage, or leave out the OR operator to get just the agent ID’s ending with a specific hex value.
These queries can be added to collections as query memberships and will provide a 100% coverage of your machines with a functioning SCCM Agent, so it might not cover all machines. On the other hand, machines without SCCM agent won’t get anything from SCCM anyway, so it’s quite alright. But in the end, it of course always depends on what you’re trying to do.




Responses to “Collection increment queries”
Leave a Reply