To automatically add new devices to an SCCM collection, follow these steps:
Create a Query-Based Collection Open the SCCM Console and navigate to Assets and Compliance > Device Collections. Create a new Device Collection or modify an existing one.
Write a SQL Query for the Collection In the collection properties, go to the Membership Rules tab. Click on Add Rule > Query Rule and define a query that dynamically includes devices based on specific attributes, such as Active Directory OU, device name, or hardware inventory properties. Example query:
pgsql
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.OperatingSystemNameandVersion LIKE "%Windows 10%"
Modify the query as needed for your environment.
Enable Incremental Updates In the Membership Rules tab, check the box for Use incremental updates for this collection. This ensures that new devices are automatically added to the collection without waiting for a full update cycle.
Apply and Monitor Save the changes and monitor the collection to verify that newly added devices appear as expected..