The Query
select SMS_R_SYSTEM.ResourceID, SMS_R_SYSTEM.ResourceType, SMS_R_SYSTEM.Name, SMS_R_SYSTEM.SMSUniqueIdentifier, SMS_R_SYSTEM.ResourceDomainORWorkgroup, SMS_R_SYSTEM.Client from SMS_R_System INNER JOIN SMS_G_System_OPERATING_SYSTEM on SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId WHERE (SMS_G_System_OPERATING_SYSTEM.Caption like "%2003%" or SMS_G_System_OPERATING_SYSTEM.Caption like "%2008%" or SMS_G_System_OPERATING_SYSTEM.Caption like "%2012%") and (DateDiff(day, SMS_G_System_OPERATING_SYSTEM.LastBootUpTime, GetDate()) > 7)Change the
7 at the end to whatever threshold in days makes sense for your environment, and add or remove Caption like entries to match the server OS versions you actually run — add "%2016%", "%2019%", or "%2022%" as needed for current server estates, since the original version list here only covers older releases.
Why This Matters Beyond Just Patch Compliance
A server that hasn’t rebooted in weeks isn’t just at risk of pending updates sitting unapplied — it’s also a sign that memory fragmentation, file handle leaks, or accumulated log/temp file bloat could be quietly building up without anyone noticing until something actually breaks. Servers that back onto a maintenance window schedule should reboot on a predictable cadence; this query is the easiest way to spot the ones that have silently fallen out of that cycle, whether from a failed patch job, a maintenance window exclusion nobody removed, or a scheduled task that stopped running.Turning This Into a Recurring Report
Rather than running this manually, pasting the query into a Configuration Manager Report (via SSRS, if you have Reporting Services Point set up) turns this into something that can be scheduled and emailed on a recurring basis — far more useful for ongoing operations than a one-off ad-hoc query you have to remember to re-run.Resources
Gear We Recommend
A few general tech accessories worth having alongside this.
Browse our General Tech Accessories picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.