A collection or query created in Configuration Manager uses WMI Query Language (WQL) to request objects from the SMS Provider WMI Schema, which in turn retrieves the data from site database.
The SMS_R_System Windows Management Instrumentation (WMI) class) is an SMS Provider server class in Configuration Manager. This class contains discovery data for all discovered system resource.
In the Query / Collection Query wizard, the friendly name of SMS_R_System is System Resource and it’s referred as Attribute Class.
In this blog post, we will discuss about most commonly used collection queries related with System Resource attribute class with examples and sample queries.
Related post: If you are looking for step by step process to create a dynamic / query based collection then follow this article : How to Create Dynamic Collection in SCCM
Other posts in this series:
- SCCM Device Collection Based on Computer Hardware Details
- SCCM Collection Queries for Opearting System Attribute Class
- SCCM device collection based on Active Directory site ( AD site )
- SCCM device collection based on AD OU
- SCCM device collection based on System resource creation date
- SCCM Collection Query / WQL Query for System Resource created after specific date
- SCCM Collection Query / WQL Query for System Resource created before specific date
- SCCM Collection Query / WQL Query for System Resource created between two dates
- SCCM Collection Query / WQL Query for System Resource created in last n number of days
- SCCM device collection based on SCCM Client Version
- SCCM device collection based on computer naming convention / nomenclature
- SCCM Collection Query / WQL Query for Windows 10 Devices without SCCM Client
- SCCM Collection Based on Active Directory Group
- Related Posts:
SCCM device collection based on Active Directory site ( AD site )
The below collection query can be used to create a dynamic collection for all computers based on Active directory site. If you are using query designer then select the below attribute class and attribute name. Otherwise you can also copy the below WQL query and paste that directly in query editor. Save and update the membership for collection to see the result.
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : Active Directory Site Name
SCCM Collection Query / 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 where SMS_R_System.ADSiteName = "HEADQUARTER"
SCCM device collection based on AD OU
The below collection query can be used to create a dynamic collection for all computers based on Active directory Organizational Unit. If you are using query designer then select the below attribute class and attribute name. Otherwise you can also copy the below WQL query and paste that directly in query editor. Do remember to change the OU name as per your requirements.
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : System OU Name
SCCM Collection Query / 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 where SMS_R_System.SystemOUName = "TECHUISITIVEL.LOCAL/COMPUTERS"
SCCM device collection based on System resource creation date
The System Resource – Creation Date attribute class / attribute name can be used to create a dynamic collection based on system resource creation date. A record is created in Configuration Manager when a resource is discovered for the first time (e.g, system discovered through Active directory system discovery).
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : Creation Date
SCCM Collection Query / WQL Query for System Resource created after specific date
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.CreationDate > "10/01/2022"
SCCM Collection Query / WQL Query for System Resource created before specific date
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.CreationDate < "10/30/2022"
SCCM Collection Query / WQL Query for System Resource created between two dates
The below query cannot be directly created in query desginer. You need to edit the query rules in query editor.
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.CreationDate BETWEEN "10/01/2022" AND "10/31/2022"
SCCM Collection Query / WQL Query for System Resource created in last n number of days
The below WQL query will include all devices which records created in SCCM in last n number of days. The query uses SQL function DateDiff and GetDate to compare current date and resource creation date to identify the resource created in last n number of days.
The below query cannot be directly created in query desginer. You need to edit the query rules in query editor.
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 (DateDiff(day, CreationDate, GetDate()) < 30)
SCCM device collection based on SCCM Client Version
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : Client Version
SCCM Collection Query / WQL Query for specific SCCM client version
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.ClientVersion = "5.00.9068.1008"
SCCM device collection based on computer naming convention / nomenclature
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : NetBIOS Name
SCCM Collection Query / WQL Query for computer name start with HQ
The below WQL query can be used to create a device collection for the computers which name start with specific characters. Many organizations use some prefix based on locations to name the computers. That can be use to identify the machines for specific location or business units. The % wildcard in SQL is used to represent zero or more characters. So anything after HQ will be picked.
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.NetbiosName like "HQ%"
SCCM Collection Query / WQL Query for computer name ending with 1, 2 or 3
This can be useful for a deployment to target on small batches of computers. Let’s say that computer name in your organization end with a number. You can have similar query based collection to split the devices into different groups. This approaches can be followed for device ending with alphabet as well.
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.NetbiosName like "%1" OR SMS_R_System.NetbiosName like "%2" OR SMS_R_System.NetbiosName like "%3")
The same result can be achieved using wild card as well. The [ ] wildcard in SQL is used to represent any one character inside brackets. So any devices which name ending with 1,2 or 3 will be included in this collection.
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.NetbiosName like "%[123]"
SCCM Collection Query / WQL Query for Windows 10 Devices without SCCM Client
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : Operating Systen Name and Version
Attribute Class 2: System Resource
Attribute Name 2: Client
The below WQL query will include Windows 10 device without SCCM client in device collection. Please note that most of the time we use Operating System (SMS_G_System_Operating_System) WMI class for OS related query. However that is an inventory class and information will not be in database until SCCM client installed and sent full hardware inventory. Hence, this query will utilize SMS_R_System discovery class to achieve the desired result.
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 "%Workstation 10.0%" and SMS_R_System.Client is Null
SCCM Collection Based on Active Directory Group
Attributes to select from Query Designer
Attribute Class : System Resource
Attribute Name : System Group
The SCCM collection membership based on Active Directory Group is widely used to delegate day to day application installation requests to Servie Desk. An Active Directory group is created for each application and SCCM collection membership updates based on AD group. The service desk simply add the user device to AD group to push the application.
The below WQL query will include all computer in given AD group to the SCCM collection.
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.SystemGroupName = "Domain\\SW-VisioViewer-Professional-2016-X64"
Related Posts:
- How to Create Dynamic Collection in SCCM
- Enclosure Chassis Types Value & Description | ConfigMgr | SCCM
- ConfigMgr: Maintenance Window for member of specific collection – SQL Query
- SCCM Dynamic Collection for Windows 10 / 11 Devices
- SCCM Device Collection Equivalents in Microsoft Intune for App Deployment
- SCCM Dynamic Collection Based on Device Type | Collection Queries
- SCCM Collection Based on Operating System Optional Features
- SCCM Device Collection Based on Installed Software Products & Inventoried Files
- SCCM Device Collection Based on Computer Hardware Details
- SCCM Collection Queries for Opearting System Attribute Class
- SCCM Collection Queries for System Resource (SMS_R_System) Attribute Class
- SCCM Dynamic Collection using Application Deployment Status
- SCCM Dynamic Collection Based on Configuration Baseline Compliance Status
- How to Create , View and Organize SCCM Maintenance Windows
- How to Provision Windows 10 / 11 Device using Intune and Windows Autopilot
Subscribe to Techuisitive Newsletter
Be the first to know about our new blog posts. Get our newsletters directly in your inbox and stay up to date about Modern Desktop Management technologies & news.