SCCM SQL Query: Pulling Server Information from the Database

This SQL query pulls together a solid “server health” snapshot directly from the SCCM database — server name, make/model, OS, architecture, install date, uptime, and when it was last inventoried — useful for a scheduled report or a quick ad hoc health check across your server estate. The Query SELECT CPU.Name0 AS 'Server Name', CPU.Manufacturer0 […]

Server Information SQL Query For SCCM
This SQL query pulls together a solid “server health” snapshot directly from the SCCM database — server name, make/model, OS, architecture, install date, uptime, and when it was last inventoried — useful for a scheduled report or a quick ad hoc health check across your server estate.

The Query

SELECT
CPU.Name0 AS 'Server Name',
CPU.Manufacturer0 AS 'Make',
CPU.Model0 AS 'Model',
OS.Caption0 AS 'Operating System',
CPU.SystemType0 AS 'x86/x64',
CONVERT(VARCHAR(26), OS.InstallDate0, 101) AS 'Install Date',
DATEDIFF(HOUR, OS.LastBootUpTime0, WS.LastHWScan) AS 'Uptime (in Hrs)',
CONVERT(VARCHAR(26), OS.LastBootUpTime0, 100) AS 'Last Reboot Date/Time',
CONVERT(VARCHAR(26), WS.LastHWScan, 101) AS 'Last Hardware Inventory'
FROM dbo.v_GS_WORKSTATION_STATUS WS
LEFT OUTER JOIN dbo.v_GS_Operating_System OS ON WS.ResourceID = OS.ResourceID
LEFT OUTER JOIN dbo.v_GS_COMPUTER_SYSTEM CPU ON CPU.ResourceID = OS.ResourceID
WHERE OS.Caption0 LIKE '%server%'
ORDER BY OS.LastBootUpTime0
The WHERE OS.Caption0 LIKE '%server%' clause is what scopes this to server operating systems only — drop it if you want the same report across your whole estate including workstations. Ordering by LastBootUpTime0 puts the longest-uptime (least recently rebooted) machines at the top, which is handy for spotting servers overdue a patch-and-reboot cycle.

Still Current on Configuration Manager 2603 (Updated for 2026)

The v_GS_WORKSTATION_STATUS, v_GS_Operating_System, and v_GS_COMPUTER_SYSTEM views this query joins against remain unchanged in current Configuration Manager (2603), so this report works exactly as written on a modern hierarchy — no need to hunt for renamed views or shifted column names. If you want to catch machines with a stale hardware inventory scan alongside the uptime figures, consider adding a DATEDIFF(DAY, WS.LastHWScan, GETDATE()) column so you can spot both a machine that hasn’t rebooted in ages and one that hasn’t checked in in ages in one pass — the two aren’t always the same machines.

Resources

🛠️

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, Active Directory, PowerShell, and enterprise infrastructure.

He founded TechyGeeksHome in 2010 and has published over 1,500 practical guides covering real-world IT problems and solutions. When not solving IT problems,

Andrew develops free Windows utilities including Ultimate Settings Panel, which has been downloaded over 850,000 times.