Posted July 6, 20177 yr Wrote this script with the help of Support. Thanks Ermins! $days = 35 $system = Get-WmiObject win32_operatingsystem if($system.ConvertToDateTime($system.LastBootUpTime) -lt (Get-Date).AddDays(-$days)){ Â Â Â Restart-Computer -Force }else{ Â Â Â Write-Host "Machine was rebooted less than $days days ago" }
July 6, 20177 yr Author Say I run this against 90 computers is there any way to get a notification of which computers rebooted?
July 11, 20177 yr Administrators All machines that reboot will timeout the script execution. So when you look at the task execution you will see it running for an hour if you don't stop it. The machines that reboot will show up as failed in the task execution results view. -Paul
Create an account or sign in to comment