Query - Computers that have not been rebooted in x days

Sometimes you need to know what computer have not been rebooted in so many days. For example at my current employers out windows update do not force the computer to reboot after so many hours it is expected that each user to shutting down there computer each night. So I have used this query to see if that is actually happening.


If you want to change the number of days that the computer has been rebooted in change the "2" at the end of the script to the number of days you want.

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 
DATEDIFF(DD, SMS_G_System_OPERATING_SYSTEM.LastBootUpTime, GETDATE()) > 2

Comments

Popular posts from this blog

SCCM Task Sequence GUI - How to set up the TS to work with a GUI

SCCM Applications vs. SCCM Packages: Understanding the Key Differences

How to Deploy a Windows 10 Servicing update as a Application