How to Create SCCM Collection Based on Operating System Attribute Class | ConfigMgr

Creating device collections in Configuration Manager (ConfigMgr/SCCM) based on operating system attributes is a powerful way to target deployments, compliance policies, and reporting. By leveraging the SMS_G_System_OPERATING_SYSTEM WMI class, admins can dynamically group devices using OS name, version, build number, or architecture. This guide walks through practical WQL queries you can use to build collections tailored to your environment.

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 the site database.

The SMS_G_System_OPERATING_SYSTEM Windows Management Instrumentation (WMI) class) is an SMS Provider server class in Configuration Manager. This class contains inventory information for the operating system.

In the Query / Collection Query wizard, the friendly name of SMS_G_System_OPERATING_SYSTEM is Operating System, and it’s referred to as Attribute Class.

In this blog post, we will discuss the most commonly used collection queries related with Operating System attribute class with examples and sample queries.

SCCM collection based on operating system attribute class

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 a Dynamic Collection in SCCM

Other posts in this series:

SCCM collection based on Operating System Name

The query below can be used to create a dynamic collection for all computers based on the Windows OS caption. If you are using the query designer, then select the attribute class and attribute name below. Otherwise, you can also copy the below WQL query and paste it directly in query editor.

Attributes to select from the Query Designer

Attribute Class: Operating System

Attribute Name: Caption

SCCM Collection Query / WQL Query for All Windows 10 devices

select distinct 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_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Caption like "Windows 10%"

SCCM Collection Query / WQL Query for All Windows 11 devices

select distinct 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_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Caption like "Windows 11%"

The above WQL query used the V_GS_System base WMI Class, which contains the information for hardware and software inventory. If you need to create a device collection for Windows 10 / 11 devices where the SCCM client is not yet installed, then you can use the SMS_R_System WMI class. Check out this article for more details about the System Resource Discovery class.

SCCM collection based on Operating System Version

The Version or Build Number attributes of the Operating System class can be used to create query based collection for sepecific OS version / Build number.

Attributes to select from the Query Designer

Attribute Class: Operating System

Attribute Name: Version / Build Number

SCCM Collection Query / WQL Query for Windows 11 22H2 devices

Please find the WQL query example below to create a collection for Windows 11 Version 22H2 computers.

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_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.Version ="​10.0.22621"

We have more examples for device collection based on OS Version in another blog post, SCCM dynamic collection for Windows 10 / 11 devices.

You can also find the details of Windows 10 / 11 OS build versions in our post Windows 10 / 11 Operating System Build Versions.

SCCM collection based on Operating System Install Date

The Operating System – Install Date attribute can be used to create a dynamic query-based collection based on OS install date.

Attributes to select from the Query Designer

Attribute Class: Operating System

Attribute Name: Install Date

SCCM Collection Query / WQL Query for Operating System installed 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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.InstallDate >= "06/29/2022"

SCCM Collection Query / WQL Query for Operating System installed before a 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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.InstallDate <= "06/29/2022"

SCCM Collection Query / WQL Query for Operating System installed between two dates

The query below cannot be directly created in the query designer. You need to edit the query rules in the 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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where SMS_G_System_OPERATING_SYSTEM.InstallDate BETWEEN "10/01/2022" AND "10/31/2022"

SCCM Collection Query / WQL Query for Operating System installed in the last n number of days

The query below will include the computers installed in the last 30 days in the collection.

The query below cannot be directly created in the query designer. You need to edit the query rules in the 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 inner join SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceId = SMS_R_System.ResourceId where (DATEDIFF(day,SMS_G_System_OPERATING_SYSTEM.InstallDate , GetDate()) < 30)

SCCM device collection based on Computer Last Boot-up time

Attributes to select from the Query Designer

Attribute Class: Operating System

Attribute Name: Last Boot-up time

SCCM Collection Query / WQL Query for computers not rebooted in the last n number of days

The below WQL query can be used to create a collection for computers that have not been rebooted for n number of days. This WQL use SQL function DateDiff and GetDate to calculate the difference between the current date and Last boot up time to find the gaps.

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_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId where (DATEDIFF(day,SMS_G_System_OPERATING_SYSTEM.LastBootUpTime , GetDate()) = 15)

Related Posts:

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.

Scroll to Top