Forum Discussion
last reboot
$Uptime= get-computerinfo | Select-Object OSUptime
if ($Uptime.OsUptime.Days -ge 7){
Write-Output "Device has not rebooted on $($Uptime.OsUptime.Days) days, notify user to reboot"
Exit 1
}else {
Write-Output "Device has rebooted $($Uptime.OsUptime.Days) days ago, all good"
Exit 0
}
Something like Rudy_Ooms_MVP is suggesting can probably also be done with https://www.petervanderwoude.nl/post/working-with-custom-compliance-settings/ (linking to Peter van der Woude's blog, because he explains it better
) which are basically Pro-active Remediations without the remediation, with compliance-flavor sprinkled over it.
All in all, there's no metadata about uptime recorded in Azure AD and/or Intune, so there's no way to report on it without extra config.
- May 02, 2022😛 and what about me explaining the custom compliance policies and how to create them and troubleshoot them 😛
https://call4cloud.nl/2021/11/the-last-days-of-custom-compliance/- admin-CPHMay 06, 2022Brass Contributor
Hi
I added the script below:
Get-CimInstance -ClassName win32_operatingsystem | select csname, lastbootuptimehow to grab the output?
Thanks- DDaly1330Oct 08, 2024Copper Contributor
Hi Rudy, would you have the JSON for the Powershell script to check a computer's uptime?
Thank you for your great articles so far.
- NielsScheffersMay 02, 2022Iron Contributor
Points deducted!
My apologies, Rudy_Ooms_MVP. I missed that one btw, so reading it now.