October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Redmond desk4 min

SCCM SQL Query: Build a Windows Version Count Dashboard

A practical Configuration Manager SQL pattern for counting Windows devices by build, with guidance on inventory scope, release mapping, dashboards and lifecycle context.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To count managed Windows devices by release in Configuration Manager, join v_R_System to the operating-system hardware inventory view v_GS_OPERATING_SYSTEM on ResourceID, map build numbers to release labels, and group the results. The SQL below is a starting pattern—not a guaranteed drop-in report. Its counts depend on which devices have reported inventory and how you define the devices in scope.

Build a SQL count by Windows release

Configuration Manager’s v_GS_OPERATING_SYSTEM view lists operating-system information found on clients, and it can be joined to other views by ResourceID. Microsoft documents the view’s purpose in its hardware inventory views reference. The following adapts a Microsoft Q&A example: it counts distinct resource IDs and keeps builds that are not mapped under a review label.

As an Amazon Associate I earn from qualifying purchases.

SELECT
    s.Operating_System_Name_and0 AS [Operating System],
    os.BuildNumber0 AS [Build Number],
    CASE
        WHEN os.BuildNumber0 = '19045' THEN 'Windows 10 22H2'
        WHEN os.BuildNumber0 = '19044' THEN 'Windows 10 21H2'
        WHEN os.BuildNumber0 = '19043' THEN 'Windows 10 21H1'
        WHEN os.BuildNumber0 = '19042' THEN 'Windows 10 20H2'
        WHEN os.BuildNumber0 = '19041' THEN 'Windows 10 2004'
        ELSE 'Other / review mapping'
    END AS [Windows Version],
    COUNT(DISTINCT s.ResourceID) AS [Total Devices]
FROM v_R_System AS s
INNER JOIN v_GS_OPERATING_SYSTEM AS os
    ON s.ResourceID = os.ResourceID
WHERE s.Operating_System_Name_and0 LIKE '%Microsoft Windows NT Workstation 10.0%'
GROUP BY
    s.Operating_System_Name_and0,
    os.BuildNumber0
ORDER BY os.BuildNumber0 DESC;

The Microsoft Q&A answer uses the same general join, build mapping and grouping approach, but counts rows with COUNT(*). The distinct-resource count here expresses the intended measure as devices rather than inventory rows. Validate the query against your site before using it as a production dashboard. The Q&A example and its caveats are available at Microsoft Q&A.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Adapt the query to your site’s inventory

Confirm the scope filter

The WHERE clause limits results to records whose operating-system name matches the Windows workstation string shown. Check the actual values in your site and decide whether to include other workstation editions or operating-system categories. A filter that is too narrow excludes devices; one that is too broad can mix records you did not intend to count.

#1 Best Overall
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 16 Core - OEM
  • 64 bit | 1 Server with 16 or less processor cores | provides 2 VMs
  • For physical or minimally virtualized environments
  • Requires Windows Server 2025 User and/or Device Client Access Licenses (CALs) | No CALs are included
  • Core-based licensing | Additional license packs required for servers with more than 16 processor cores or to add VMs | 2 VMs whenever all processor cores are licensed.
  • Product ships in plain envelope | Activation key is located under scratch-off area on label |Beware of counterfeits | Genuine Windows Server software is branded by Microsoft only.

Decide which devices count

The join only returns resources with matching records in both views. Inventory timing and client health therefore affect what appears. Define how your report should handle stale clients, devices that have not submitted operating-system inventory, and any duplicate or obsolete records in your environment. The query does not establish a universal definition of “managed device.”

Review unmapped builds and labels

The ELSE branch keeps unrecognized build numbers visible instead of silently assigning them to a known release. Retain the raw build column so administrators can check the mapping and extend the CASE expression when needed. For example, Microsoft identifies Windows 10 version 22H2 with base build 19045. Build alone does not tell you whether an installation is a general-availability edition or an LTSC/LTSB edition.

Rank #2
Windows Server 2025 User CAL 5 pack
  • Offers quick and easy installation on PC
  • The software is licensed for 5 User CAL

Choose between a custom count and built-in dashboards

A SQL query is suited to a precise count grouped the way your report consumers need it. Configuration Manager also includes a Windows servicing dashboard for servicing and build information, and a product lifecycle dashboard for supportability and end dates. Microsoft’s Windows servicing documentation describes those dashboards and their prerequisites. Dashboard availability and freshness depend on the deployed Configuration Manager version and required service connection and synchronized servicing/update data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use a custom query when the main deliverable is a count by a specific release or build, with an explicit device scope.
  • Use the servicing dashboard when the question is about servicing or build status and its displayed information meets the need.
  • Use the product lifecycle dashboard when the key question is supportability or end dates.
  • Check whether the report must distinguish editions such as LTSC; a release label or build grouping by itself may not do so.

Microsoft also documents a console query for listing Windows 10 computer names and operating-system versions. That is WQL for a Configuration Manager query, not the SQL aggregation above. See Create queries in Configuration Manager.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Interpret Windows 10 22H2 counts with lifecycle in mind

Microsoft’s Windows release information identifies 19045 as the Windows 10 version 22H2 base build. The same page states that Windows 10 reached end of support on October 14, 2025; general-availability editions of 22H2 reached end of updates on that date. LTSC and LTSB editions follow separate lifecycles, so a count labeled “Windows 10 22H2” is not by itself a supportability report. Check the edition and applicable lifecycle before drawing conclusions. See Windows 10 release information.

The release page’s September 2026 revision lists 22H2 build 19045.7727 for the September 2026 out-of-band update, alongside separate LTSC/LTSB build information. That is a revision-specific update value, not the base release identifier used by the query’s mapping. Verify current release information when maintaining the dashboard because servicing data changes over time. Microsoft describes 22H2 as a scoped feature release and notes availability through Windows Server Update Services, including Configuration Manager, in its Windows 10 version 22H2 overview.

Quick Recap

Bestseller No. 1
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 16 Core - OEM
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 16 Core - OEM
64 bit | 1 Server with 16 or less processor cores | provides 2 VMs; For physical or minimally virtualized environments
$949.99
Bestseller No. 2
Windows Server 2025 User CAL 5 pack
Windows Server 2025 User CAL 5 pack
Offers quick and easy installation on PC; The software is licensed for 5 User CAL
$252.99
SaleBestseller No. 3
Bestseller No. 4
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 24 Core - OEM
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 24 Core - OEM
64 bit | 1 Server with 24 or less processor cores | provides 2 VMs; For physical or minimally virtualized environments
$1,499.99
Bestseller No. 5
Windows Server 2025 User CAL
Windows Server 2025 User CAL
Unlock all the features by installing this product on PC; The software is licensed for 1 User CAL
$69.99
Best Value
Windows Server 2025 User CAL
  • Unlock all the features by installing this product on PC
  • The software is licensed for 1 User CAL
Rank #4
Microsoft Windows Server 2025 Standard Edition 64-bit, Base License, 24 Core - OEM
  • 64 bit | 1 Server with 24 or less processor cores | provides 2 VMs
  • For physical or minimally virtualized environments
  • Requires Windows Server 2025 User and/or Device Client Access Licenses (CALs) | No CALs are included
  • Core-based licensing | Additional license packs required for servers with more than 16 processor cores or to add VMs | 2 VMs whenever all processor cores are licensed.
  • Product ships in plain envelope | Activation key is located under scratch-off area on label |Beware of counterfeits | Genuine Windows Server software is branded by Microsoft only.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.