Query last reboot time?

Hi,

I'd like to see last reboot time of different collection, so I want to target a query to those different collection.
What query could I use?

Please advise.

June 17th, 2015 5:39am

Hello,

You wish to build a collection, based on last boot time?

This information would not be very reliable since it would be based on your Hardware Inventory. And based on how often your Hardware Inventory is set to run, how much "luck" you have had with timing it with the reboots ...

I would not attempt to build this.

Free Windows Admin Tool Kit Click here and download it now
June 17th, 2015 5:43am

Thanks but no, I want to query a collection to see last boot time.
June 17th, 2015 5:45am

Hi,

I have used this in the past:

http://blog.coretech.dk/kea/query-and-report-all-workstations-that-havent-rebooted-the-last-7-days/

  • Marked as answer by janhoedt 19 hours 56 minutes ago
Free Windows Admin Tool Kit Click here and download it now
June 17th, 2015 6:40am

Thanks, but when I use this query:

SELECT DISTINCT SMS_R_System.Name, SMS_G_System_OPERATING_SYSTEM.LastBootUpTime, SMS_G_System_OPERATING_SYSTEM.Caption
FROM SMS_R_System INNER JOIN SMS_G_System_OPERATING_SYSTEM ON SMS_G_System_OPERATING_SYSTEM.ResourceID = SMS_R_System.ResourceId

to a collection of 8 pc's,  I can see boot times for today 11:52 and most others are from yesterday. That would mean I had that much luck that all hardware inventories would have ran today/yesterday?

June 17th, 2015 7:48am

Yes that sounds about right.

You could check to see if all the devices have ran a hardware from an age specified.

http://myitforum.com/cs2/blogs/gramsey/archive/2007/04/25/using-datediff-and-getdate-in-wql-for-sms-queries-and-collections.aspx

Might be easier to look in SQL,

I always have hardware inventory running every 24 hours, what is your's set to.

Free Windows Admin Tool Kit Click here and download it now
June 17th, 2015 8:05am

Try Configuration baseline, using powershell script below.

#Use Get-WMIObject to read the Win32_OperatingSystem class           
$Win32OS = Get-WMIObject -Class Win32_OperatingSystem           
           
#Calculate the uptime based on the LastBootUpTime property and the local date and time           
$Uptime = $Win32OS.ConvertToDateTime($Win32OS.LocalDateTime) - `
$Win32OS.ConvertToDateTime($Win32OS.LastBootUpTime)           
           
#Check if the total number of days in our uptime calculation is greater than 7           
#Return a 0 for a non-compliant system and a 1 if the system is compliant           
if ($Uptime.TotalDays -gt 7){           
 $compliant = 0           
}           
else {           
 $compliant = 1           
}           
           
echo $compliant

June 17th, 2015 9:39am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics