In this post I will show you how to create Windows 11 and Windows Server 2022 device collection on SCCM. The information on how to create a specific collection can be explored through WMI, we can either use wbemtest or WMIExplorer which is much more efficient. These will be the important aspects while creating SCCM. collection.

How to explore what query to use for Device collection

WMI explorer is a very nice tool through which we can explore the sms provider and the tables under it to see the information we are looking for. WMI Explorer 2.0 can be downloaded through this link. We could have used inbuilt windows Wbemtest (Windows Management Instrumentation Tester) but that is not so user friendly and GUI is missing.

Once downloaded and launched the WMI Explorer, connect to SCCM Server (SMS Provider) with format root\sms\site_<sitecode> if local or \\ServerName\root\sms\site_<sitecode> if remote. In my case it is root\sms\site_MAN.

Once connected click on Query tab and run following WQL Query.

select * from SMS_G_System_Operating_System

We can see the following results based upon the different Operating Systems I have in my environment:

WMI Explorer 2.0
BootDeviceBuildNumberCaption
\Device\HarddiskVolume119041Microsoft Windows 10 Enterprise
\Device\HarddiskVolume217763Microsoft Windows Server 2019 Datacenter
\Device\HarddiskVolume120348Microsoft Windows Server 2022 Datacenter
\Device\HarddiskVolume218363Microsoft Windows 10 Enterprise
\Device\HarddiskVolume119042Microsoft Windows 10 Enterprise
\Device\HarddiskVolume122000Microsoft Windows 11 Enterprise

The only problem with this approach of using SMS_G_System_Operating_System table is that, it only gets populated if hardware inventory has run. You can see I in above table there are 6 rows only, while I have more devices. Hence, I will show you 2 different queries which can be used for Windows 11 Device collection.

Hence, the key takeaway for Windows 11:
Caption: Microsoft Windows 11 Enterprise
BuildNumber: 22000 (The current Windows 11 Build)

For Windows Server 2022:
Caption: Microsoft Windows Server 2022 Datacenter
BuildNumber: 20348

We are ready with the information for create of SCCM Device collection

How to create Windows 11 Device collection – 1

Keep in mind, as discussed previously, the query shared here will not be able to pull all Windows 11 devices because of dependency upon hardware inventory to fetch caption column. I will share other query in section How to create Windows 11 Device collection – 2 but that also has its own Pros and Cons

Once Windows 11 is domain joined and its entry is generated in SCCM database, the build information will be populated as part of hardware inventory.

Login to SCCM server and launch Configuration Manager console, navigate to \Assets and Compliance\Overview\Device Collections, from top menu click Create Device Collection.

Device Collections

On Create Device Collection Wizard page, provide name as All Windows 11 and use All Systems as Limiting collection, click Next.

Specify details for this collection

On Membership Rules page, click Add Rule and select Query Rule as we are going to use query based rule.

Membership Rules

On Query Rule Properties page, specify name as “Widnows 11” and click on Edit Query Statement which will open Query Statement Properties

Show Query Language

On Query Statement Properties page, click on Show Query Language to open Query Statement and provide following WQL query:

Query Language
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.Caption like 'Microsoft Windows 11%'

Note: I have omit Enterprise and ended it with ..Windows 11%’ so that all Windows 11 devices can be fetched irrespective of specific version.

To Create Windows 11 collection with specific version, we can use:

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.BuildNumber like '22000'

You can click on Show Query Design to return to a different view, Open in code editor gives another option to create and experiment the query on the go to see live results, click OK twice to return to Define membership rules page where Rule Name is now created, click Next.

CreateWin11 2022 collection 07

On Confirm the settings page, click Next and close the page.

We have now Device Collection ready for All Windows 11  collection with 1 member.

How to create Windows 11 Device collection – 2

The query which I am sharing here will fetch all Windows 11 devices as we are just relying on sms_r_system table and it fetch the OS information without any need of Hardware inventory. This is the same method I used in my previous blog Create SCCM Windows Workstation and Server Device collection. Following is the query for creation of Windows 11 collections:

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 OperatingSystemNameandVersion like '%workstation%10%' and build like '10.0.22000%'

This looks like a perfect query for Windows 11, but upon closer look we can see OperatingSystemNameandVersion is Microsoft Windows NT Workstation 10.0 and build is 10.0.22000. The problem here is the OS version for Windows 10 & Windows 11 – both are using Workstation 10.0 naming convention, hence this column alone is not sufficient to differentiate between Windows 10 / 11, hence we have to use Build column and I used ‘10.0.22000%’, this looks good at this current stage but what happens when another version of Windows 11 is released after 1 year (Windows 11 is expected to get new feature update every year), hence at that moment we need to modify the query and have to add new build version (for example new version is 10.0.22500, we will be modifying the and of the query something like this:

where OperatingSystemNameandVersion like '%workstation%10%' and (build like '10.0.22000%' or build like '10.0.22500%')

How to create Windows Server 2022 Device Collection – 1

To create Windows Server SCCM collection, we will be again taking the reference from WMI Explorer where we got Caption for Server 2022. We will be using same query previously used with little modification ie. Caption like ‘Microsoft Windows Server 2022%’

WQL Query to create Windows Server 2022 SCCM collection is:

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.Caption like 'Microsoft Windows Server 2022%'

How to create Windows Server 2022 Device Collection – 2

WQL Query to create Windows Server 2002 collection (to pull all devices) – much more efficient way but requires modification in query with every new release of Windows Server Feature Update. the same explanation is applicable here is also which I explained under How to create Windows 11 Device collection – 2

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 OperatingSystemNameandVersion like '%server%10%' and build like '10.0.20348%'