Script to reboot machines that not rebooted in the last 10 days - nonoloki2/Devops GitHub Wiki
$bootuptime = (Get-CimInstance -ClassName Win32_OperatingSystem).LastBootUpTime $CurrentDate = Get-Date $uptime = $CurrentDate - $bootuptime $uptime.Days $cmd = cmd /c $commands = shutdown -r -f -t 3600 if ($uptime.Days -gt 10) { Start-Process $cmd $commands
}