Find computers with no hardware inventory in 30 days
SQL query for the Configuration Manager database that lists clients with a last hardware scan older than a number of days, or no scan at all.
LanguageSQL
What it does to the systemReads only. It changes nothing.
Most reports in Configuration Manager use hardware inventory. A client that stops sending inventory gives you old or missing data.
The result shows each client with an old scan date or no scan date. It also shows the days since the last scan.
SQL
-- Change this number to set the limit in days.
DECLARE @Days INT = 30;
SELECT
rs.Name0 AS ComputerName,
rs.Client_Version0 AS ClientVersion,
ws.LastHWScan AS LastHardwareScan,
DATEDIFF(DAY, ws.LastHWScan, GETDATE()) AS DaysSinceScan
FROM v_R_System rs
LEFT JOIN v_GS_WORKSTATION_STATUS ws
ON ws.ResourceID = rs.ResourceID
WHERE rs.Client0 = 1
AND ISNULL(rs.Obsolete0, 0) = 0
AND (ws.LastHWScan IS NULL
OR ws.LastHWScan < DATEADD(DAY, -@Days, GETDATE()))
ORDER BY ws.LastHWScan;
How to use it
- Open SQL Server Management Studio and connect to the site database.
- Paste the query into a new query window.
- Change
@Daysto the limit you want. - Run the query.
- Check the rows with an empty scan date first. Those clients never sent inventory.
Good to know
- The query uses a LEFT JOIN so clients with no inventory record still show.
- A computer that is turned off for a long time also shows here. Check it against your inactive clients.
hardware inventory
client health
v_GS_WORKSTATION_STATUS
v_R_System
More SCCM SQL queries
List inactive or unhealthy Configuration Manager clients
Check BitLocker protection status for each computer
Count Configuration Manager client versions in your environment
Find computers that have not rebooted in 14 days
Find computers with low free space on the C: drive
Find duplicate computer names and duplicate serial numbers