SCCM Report Query for Machine Make and Model Count

SQL queries to count every hardware make and model in Configuration Manager, including active clients only, Lenovo friendly names, laptops vs desktops.

SCCM Report Query for Machine Make and Model Count

When you are planning a hardware refresh, checking which machines can take a new driver pack, or just answering “how many of those old laptops are still out there?”, a count of every make and model in the estate is the first thing you want. Configuration Manager already holds this in its hardware inventory, so one SQL query against the site database gives you the answer in seconds. This guide covers the basic query, a better version that ignores stale and obsolete records, how to deal with Lenovo’s odd model codes, and how to turn the result into a report or a collection.

The basic make and model count

Run this in SQL Server Management Studio against your site database (CM_XXX, where XXX is your site code), or use it as the dataset in a report:

SELECT Manufacturer0 AS Manufacturer,
       Model0 AS Model,
       COUNT(*) AS DeviceCount
FROM v_GS_COMPUTER_SYSTEM
GROUP BY Manufacturer0, Model0
ORDER BY DeviceCount DESC

The data comes from the Computer System (Win32_ComputerSystem) hardware inventory class, which is enabled in the default client settings. Always query the v_ views rather than the underlying tables: Microsoft supports the views and keeps them stable between releases, while the tables can change.

A better version: active clients only

The simple query counts every inventory record in the database, including machines that were rebuilt under a new name, have been sitting in a cupboard for a year, or are marked obsolete. For planning purposes that inflates the numbers. Joining to v_R_System and the client health summary keeps it to devices that are actually alive:

SELECT cs.Manufacturer0 AS Manufacturer,
       cs.Model0 AS Model,
       COUNT(DISTINCT sys.ResourceID) AS DeviceCount
FROM v_R_System sys
JOIN v_GS_COMPUTER_SYSTEM cs ON cs.ResourceID = sys.ResourceID
JOIN v_CH_ClientSummary ch ON ch.ResourceID = sys.ResourceID
WHERE sys.Client0 = 1
  AND ISNULL(sys.Obsolete0, 0) = 0
  AND ch.ClientActiveStatus = 1
GROUP BY cs.Manufacturer0, cs.Model0
ORDER BY DeviceCount DESC

If you want servers and desktops counted separately, add sys.Operating_System_Name_and0 to the SELECT and GROUP BY, or filter with AND sys.Operating_System_Name_and0 LIKE '%Workstation%' for client operating systems only.

Lenovo models show up as codes

On Dell and HP hardware, Model0 is a readable name such as “Latitude 5450”. Lenovo puts the machine type there instead, so you get a list of values like “21HDS0X200” that mean little to anyone outside the service desk. The friendly name lives in the Computer System Product class, in the Version0 column:

SELECT csp.Vendor0 AS Manufacturer,
       CASE WHEN csp.Vendor0 = 'LENOVO' THEN csp.Version0 ELSE cs.Model0 END AS Model,
       COUNT(DISTINCT cs.ResourceID) AS DeviceCount
FROM v_GS_COMPUTER_SYSTEM cs
JOIN v_GS_COMPUTER_SYSTEM_PRODUCT csp ON csp.ResourceID = cs.ResourceID
GROUP BY csp.Vendor0, CASE WHEN csp.Vendor0 = 'LENOVO' THEN csp.Version0 ELSE cs.Model0 END
ORDER BY DeviceCount DESC

That gives you “ThinkPad T14 Gen 4” rather than a part number. The same split matters when you write driver or BIOS conditions in task sequences, which our guide on updating a Lenovo BIOS with SCCM covers in more detail.

Laptops versus desktops

For a refresh plan it often helps to know which models are laptops. The chassis type is stored in the System Enclosure class. Values 8, 9, 10, 14, 30, 31 and 32 are the portable types (laptop, notebook, convertible and so on):

SELECT cs.Manufacturer0, cs.Model0,
       CASE WHEN se.ChassisTypes0 IN (8,9,10,14,30,31,32) THEN 'Laptop' ELSE 'Desktop/Other' END AS FormFactor,
       COUNT(DISTINCT cs.ResourceID) AS DeviceCount
FROM v_GS_COMPUTER_SYSTEM cs
JOIN v_GS_SYSTEM_ENCLOSURE se ON se.ResourceID = cs.ResourceID
GROUP BY cs.Manufacturer0, cs.Model0,
       CASE WHEN se.ChassisTypes0 IN (8,9,10,14,30,31,32) THEN 'Laptop' ELSE 'Desktop/Other' END
ORDER BY DeviceCount DESC

The full list of values is in our SCCM chassis types reference.

Turning it into a report

Running the query by hand is fine for a one-off, but if management want the numbers every month, publish it as a report. In the console go to Monitoring > Reporting > Reports, choose Create Report, pick a SQL-based report and paste the query in as the dataset in Report Builder. Once it is saved you can set up a subscription to email it as Excel or PDF on a schedule. Our walkthrough on building a custom SCCM report with SQL goes through each step.

A collection for one model

SQL is for reporting; collections use WQL. If you want a collection of every device of a particular model, for example to target a driver update, use this as a query membership rule:

select SMS_R_System.ResourceId, SMS_R_System.Name
from SMS_R_System
inner join SMS_G_System_COMPUTER_SYSTEM on SMS_G_System_COMPUTER_SYSTEM.ResourceId = SMS_R_System.ResourceId
where SMS_G_System_COMPUTER_SYSTEM.Model = "Latitude 5450"

Why the numbers might look wrong

  • Inventory has not run yet. Hardware inventory runs every 7 days by default, so machines bought or rebuilt this week may not appear until their next cycle. You can trigger it on a client from the Configuration Manager control panel applet (Actions tab, Hardware Inventory Cycle).
  • The class is disabled. Check the client settings that apply to the devices and make sure Computer System is ticked under Hardware Inventory classes.
  • Virtual machines. Hyper-V and VMware guests report models such as “Virtual Machine” or “VMware20,1”. Filter them out with WHERE cs.Model0 NOT LIKE '%Virtual%' AND cs.Model0 NOT LIKE 'VMware%' if you only care about physical kit.
  • Duplicate records. Rebuilt machines can leave an obsolete record behind, which is why the active-clients version above is worth using.

Still valid on current Configuration Manager

These queries work on the current branch releases of Configuration Manager in 2026. The v_GS_COMPUTER_SYSTEM, v_GS_COMPUTER_SYSTEM_PRODUCT and v_GS_SYSTEM_ENCLOSURE views have not changed in years, so the same SQL runs on older sites too.

FAQ

Can I get the same information from Intune?

Yes. In the Intune admin centre, Devices > All devices can be exported with the Manufacturer and Model columns, and you can pivot the CSV in Excel. If you are co-managed, the ConfigMgr data is usually more complete for older machines.

Do I need special rights to run the query?

You need read access to the site database. In most organisations the safest route is a report, because Reporting Services handles the permissions through Configuration Manager’s role-based access.

Where can I find more ready-made queries?

Our SCCM SQL and WQL query library has dozens more, from installed software to low disk space.

🛠️

Gear We Recommend

Testing configs is easier with a dedicated admin machine set up right. Here’s the kit we use.

Browse our Windows Admin Toolkit picks on Amazon

As an Amazon Associate, TechyGeeksHome earns from qualifying purchases.


Discover more from TechyGeeksHome

Subscribe to get the latest posts sent to your email.

Andrew Armstrong

Andrew Armstrong is a UK-based IT professional with 26+ years of hands-on experience in Windows, Windows Server, SCCM/ConfigMgr, Intune, Active Directory, PowerShell and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published 770+ practical guides to real-world IT problems. He also builds free Windows utilities, including Ultimate Settings Panel, which has been downloaded over 850,000 times.

One thought on “SCCM Report Query for Machine Make and Model Count”

Comments are closed.

Part of The Geek Network