Skip to content
CMPivot Query to Find Windows 10 or 11 Devices from SCCM

CMPivot Query to Find Windows 10 or 11 Devices from SCCM

Written By Anoop C Nair
Last Updated February 23, 2022
Posted In SCCM
SHARE

Let’s try to use the CMPivot query to find Windows 10 or Windows 11 devices from SCCM. There are different ways to find Windows 11 or 10 devices from SCCM. CMPivot is one of the easiest and quickest ways to find the latest information about Windows 10 or 11 devices.

I have already shared tips about CMPivot Query to find Windows devices with the English Language. The CMPivot query to find Windows 10 devices quickly is useful to segregate Windows 11 and Windows 10 devices. I also share the different methods to find Windows 10 devices in this post.

If you are looking for a WQL query to create a collection to find Windows 10 or Windows 11 devices, then you can head over to the best practices blog post. You can also use the same CMPivot queries from the Microsoft Endpoint Manager portal to collect the same details about co-managed / Tenant Attached devices.

I will share the options to find out Windows 11 devices using SQL queries as well. You can get access to the free Windows 11 dashboard from the post SCCM Report for Windows 11 Dashboard. This dashboard gives you the version details along with the total number of devices in each version.

Patch My PC

CMPviot Query to find out Windows 11 Devices

Let’s check the CMPviot Query to find out Windows 11 Devices using the build numbers. Windows 11 build numbers are based on the 22000 series. You will need to use this build number to find out the list of Windows 11 devices in your SCCM environment.

The basic details of SCCM CMpviot and how to launch CMPivot are not covered in this post. Let’s have a quick look at the SCCM CMPivot query for Windows 11 devices using the build number in this section.

The starting build number for Windows 11 is “22000” and maximum the build number for Windows 11 could go up to “30000” (I assume).

Launch SCCM CMPivot using any of the preferred methods (I like to launch it from a specific device collection) and use the following query to find out the Windows 11 devices.

OperatingSystem | where BuildNumber >= '22000' and BuildNumber < '30000'

You have options to export the list of Windows 11 devices into CSV format and then to Excel, etc. You can filter Windows 11 devices based on Caption also. More details are below.

CMPviot Query to find out Windows 11 Devices CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM
CMPviot Query to find out Windows 11 Devices – CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM

List Window 11 Devices using SCCM CMPivot Query based on OS Caption

Let’s list down Window 11 Devices using SCCM CMPivot Query based on OS Caption. Operating System “Caption” is one of the fields available with the SCCM CMPivot entity called OperatingSystem.

I have used the caption options for Windows 11 – Microsoft Windows 11 Enterprise, Microsoft Windows 11 Education, and Microsoft Windows 11 Pro Insider Preview

OperatingSystem 
| where Caption == 'Microsoft Windows 11 Enterprise' 
or Caption == 'Microsoft Windows 11 Eduation'
or Caption == 'Microsoft Windows 11 Pro Insider Preview'
List Window 11 Devices using SCCM CMPivot Query based on OS Caption
List Window 11 Devices using SCCM CMPivot Query based on OS Caption

CMPivot Query using Window 10 Build Number

You can use the following query to find Windows 10 devices. This query is using the same logic that I used in the above-mentioned blog post. The main logic behind this query is the maximum and minimum build numbers of Windows 10.

  • Maximum build number for Windows 10 will less than 20000 for sure(?yes).
  • Minimum build number for Windows 10 is greater than 10000.

You can launch the CMPivot tool from the console or as a standalone tool. Select any device collection, and Run CMPivot button from the ribbon menu to launch CMPiovt. You can click on the query tab and paste the following query.

OperatingSystem | where BuildNumber < '20000' and BuildNumber > '10000'

NOTE! – You can see the results in the below screenshot. One is highlighted in bold, and the other record is with normal color. Well, it seems CMPivot can now show the basic details of OFFLINE PCs as well. PROD-WIN21 PC is offline for many days but still shows up in Windows 10 CMPivot query.

CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM
CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM

CMPivot Query based on Caption for Windows 10

Let’s quickly check the way to find out Windows 10 or Windows 11 devices using CMPivot query based on Caption of the operating system. This query will collect the devices with Windows 10 Enterprise version.

If you manage devices with some other versions of Windows 10 like education, you will need to change this query to Microsoft Windows 10 Education.

OperatingSystem | where Caption == 'Microsoft Windows 10 Enterprise'
OperatingSystem | where Caption == 'Microsoft Windows 10 Education'
CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM
CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM

Graphical Represenation using CMPivot query

You can create some graphical representation of the Windows 10 data using the CMPivot tool and query. Some of the other default options to render graphs are not supported for the Count () function. The following examples help you produce the total count of Windows versions within SCCM, and it will be represented as a bar chart, column chart, or pie chart.

OperatingSystem | summarize count() by Caption | render barchart
OperatingSystem | summarize count() by Caption | render columnchart
OperatingSystem | summarize count() by Caption | render piechart

Following is another quick query is to find Windows build numbers available in SCCM. You can check the different build numbers available in your SCCM infra. I don’t know how much useful information is this. However, if you run this query against all Windows 10 devices collection, then it’s useful for sure.

OperatingSystem | summarize count() by BuildNumber | render piechart
CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM
CMPivot Query to Find Windows 10 or Windows 11 Devices from SCCM

SQL Query to Find out Windows 11 Devices

Let’s try to use the following SQL query to find out Windows 11 devices. You can go through the following steps to get the list of Windows 11 devices in your environment.

  • Open the SQL Management Studio.
  • Connect your Database Engine.
  • Right Click on your database CM_XXX and click on ‘New Query’
  • Copy the following SQL query to find the report to get the list of Windows 11 PCs.
  • Click on the Execute button.
select v_R_System.Name0 as 'Hostname',
v_R_System.User_Name0 as 'Username',
v_GS_OPERATING_SYSTEM.Caption0 as 'Operating System',
v_GS_OPERATING_SYSTEM.BuildNumber0 as 'Build Number'
from v_r_system
inner join v_gs_operating_system
on v_R_System.ResourceID=v_GS_OPERATING_SYSTEM.ResourceID
where v_GS_OPERATING_SYSTEM.BuildNumber0 >= '22000' and v_GS_OPERATING_SYSTEM.BuildNumber0 < '30000'
order by v_R_System.Name0
SQL Query to Find out Windows 11 Devices
SQL Query to Find out Windows 11 Devices

Resources

Written by

Anoop C Nair is Workplace Technology solution architect with 25+ years of experience in global enterprise organizations such as JP Morgan, Capgemini, etc. Microsoft Certified Trainer. Microsoft MVP from 2015 onwards for consecutive 11+ years! He also conducts Intune and modern workplace tech training for enterprise organizations. He is Blogger, Speaker, and Founder of HTMD Community and HTMD Conference. His main focus is on Device Management technologies like Intune, Windows, Cloud PC. He writes about technologies like Intune, SCCM, Windows, Cloud PC, Windows, Entra, Microsoft Security.

Discussion

Join the discussion

Your email address will not be published. Required fields are marked *

Related guides

Intune

Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws

Key Takeaways Windows 11 KB5101650 KB5099414 July 2026 Patch and 3 Zero Day Vulnerabilities and 570 Flaws! In the July 2026 Patch, Microsoft introduced new features designed to improve the overall Windows experience. The update adds enhancements to Windows Update for more flexible update management and introduces Point-in-Time Restore, providing an additional recovery option for […]

AC Anoop C Nair 9 min read
Intune

2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws

Key Takeaways 2026 June KB5094126 KB5093998 Windows 11 Patch | 3 Zero Day Vulnerabilities and 200 Flaws! The June 2026 Windows 11 Patch Tuesday update brings several improvements to File Explorer. It adds support for additional archive formats, including UU, CPIO, XAR, and NuGet Packages (NUPKG). The update also preserves View and Sort preferences in […]

AC Anoop C Nair 10 min read
Intune

2026 May KB5089549 KB5087420 Windows 11 Patch | 0 Zero Day Vulnerabilities and 120 Flaws

Key Takeaways The Windows 11 May 2026 Patch KB5089549 KB5087420 Update brings important security fixes, performance improvements, and reliability enhancements across the operating system. The update introduces new features such as Xbox Mode for gaming, File Explorer improvements, enhanced input and sharing experiences, better taskbar and Windows Hello reliability, and additional enterprise management capabilities for […]

AC Anoop C Nair 8 min read
SCCM

ConfigMgr 2603 Introduces New Early Update Enrollment Process

Key Takeaways In this post we are discussing the ConfigMgr 2603 Introduces New Early Update Enrollment Process. Microsoft has officially released Configuration Manager version 2603 to the Early Update Ring, giving organizations an opportunity to test upcoming improvements before the global production rollout. The release is targeted at enterprises running ConfigMgr version 2409 or later […]

AC Anoop C Nair 3 min read