How to Generate a Report of Client Device Uptime in SCCM with Serial Numbers

Monitoring client device uptime is crucial for ensuring system health, stability, and compliance—especially in enterprise environments. In Microsoft Endpoint Configuration Manager (SCCM), you can quickly fetch and export this information using a simple SQL query.

In this guide, we’ll walk you through a SQL script that retrieves the hostname, last boot time, and uptime in days for each client device, while also including a neat serial number (SNo) column for easy reference.


✅ SQL Query to Fetch SCCM Client Uptime (Ordered from Lowest to Highest)


SELECT  
    ROW_NUMBER() OVER (ORDER BY DATEDIFF(DAY, os.LastBootUpTime0, GETDATE()) ASC) AS 'SNo',  
    sys.Name0 AS 'Hostname',  
    os.LastBootUpTime0 AS 'Last Boot Time',  
    DATEDIFF(DAY, os.LastBootUpTime0, GETDATE()) AS 'Uptime (Days)'  
FROM v_GS_OPERATING_SYSTEM AS os  
JOIN v_R_System AS sys ON os.ResourceID = sys.ResourceID  
ORDER BY [Uptime (Days)] ASC;

📝 What This Script Does

  • SNo: Auto-incremented row number for clarity and reporting.
  • Hostname: Client machine name, pulled from SCCM’s v_R_System view.
  • Last Boot Time: The timestamp of the last system reboot.
  • Uptime (Days): Calculates the number of days since the last reboot using DATEDIFF().

The results are sorted from the lowest uptime to the highest, making it easy to spot recently rebooted machines.



💡 Use Cases

  • Detect devices that may require a restart.
  • Spot frequently rebooting clients (useful in troubleshooting).
  • Filter devices for patch compliance and maintenance planning.

👨‍💻 Final Thoughts

With just a few lines of SQL, SCCM admins can unlock powerful visibility into device uptime. Whether you’re tracking performance, automating maintenance, or meeting compliance goals, this query is a handy tool for your toolbox.

If you found this guide helpful, feel free to share or leave a comment below!

Leave a Comment