DigitalDentist Posted July 6, 2017 Posted July 6, 2017 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" }
DigitalDentist Posted July 6, 2017 Author Posted July 6, 2017 Say I run this against 90 computers is there any way to get a notification of which computers rebooted?
Administrators Paul Posted July 11, 2017 Administrators Posted July 11, 2017 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now