Posted on 11-04-2016 10:54 AM
How do I check to see when the user restarted the computer in JSS ?
Posted on 11-04-2016 10:59 AM
@Zohaib24 AFAIK to do this you'll need to use an Extension Attribute. You can grab either the uptime of a computer or the last reboot. You can read about either method in this thread:
Create an extension attribute that reports last reboot for a mac
I have an EA for both methods, both from that discussion, but the reboot one is this:
#!/bin/bash
echo "<result>$(date -jf "%s" "$(sysctl kern.boottime | awk -F'[= |,]' '{print $6}')" +"%Y-%m-%d %T")</result>"
Posted on 11-04-2016 11:02 AM
Posted on 11-04-2016 11:06 AM
@Sandy ah, yes, forgot about that. However, you have to have Computer Usage enabled for that data to be gathered. We do not collect that data here, hence the EA.
Posted on 11-04-2016 11:15 AM
And if you want to know where to check or un-check that option :
Posted on 09-07-2018 02:33 PM
Zohaib24's solution worked like a charm. Thanks!