Tips and Resources

Schedule Computer Automatic Wake from Sleep and Reboot

Guide for Scheduling an automatic wake and reboot of your computers using Group Policy.

The below notes will create a scheduled task on each machine that will wake the device from sleep and perform a reboot.

Open Group Policy Management, edit a group policy object linked to the computers you wish to reboot (or create a new one). Navigate to Computer Configuration -> Preferences -> Control Panel Settings -> Scheduled Tasks.

Right Click Scheduled Tasks and choose New-> Scheduled Task (At least Windows 7)

Setup the New scheduled task with the following options:

General -> Action: Update

General -> Name: Scheduled Reboot

General -> Description: Wake to reboot overnight to install updates & deployed software.

General -> Security Options -> User Account: NT AUTHORITY\System

General -> Security Options -> Run whether user is logged in or not 

General -> Security Options -> Run with highest privileges

Triggers -> New -> I set mine to run On a schedule, Daily and Delay task for up to (random delay) 30 minutes. The delay prevents or application deployment servers from being hit by every machine on the network all at once.  

Actions -> New -> Action: Start a program

Action -> Settings -> Program/script: shutdown.exe

Action -> Add arguments(optional): /r

Conditions -> Wake the computer to run this task

Troubleshooting 

Disable Hybrid Sleep/Hibernation using Group Policy

You may find that when hibernation is enabled on your computers, it may prevent resuming from sleep. You can disable Hibernate on all computers using Group Policy - One method to do this is add a startup script:

On a group policy object linked to your endpoint devices OU, navigate to Computer Configuration -> Policies -> Windows Settings -> Scripts -> Startup Click Add. Enter powercfg.exe  as the script name and add -H OFF as the script parameters.

 

Enable Allow Wake Timers

The computer may be set to only wake from 'important' wake timers, which may prevent your scheduled task from waking and rebooting the machine. You can change the power options for the power plan the computer is using by clicking Start, type 'Edit Power Plan' and click Edit Power Plan.

Click Change advanced power settings. In the list of settings, scroll down to the Sleep section and Expand the Allow wake timers section. Change the settings from Important Wake Timers Only to Enable.

You can set this option on your machines using group policy using a script that will update all the power profiles with this option set to enabled:

<# Balanced, High performance and Power Saver Power Profile set Allow wake timers to enabled #>
powercfg /SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 1
powercfg /SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 1
powercfg /SETACVALUEINDEX a1841308-3541-4fab-bc81-f71556f20b4a 238c9fa8-0aad-41ed-83f4-97be242c8f20 bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d 1

Enable HPET (High Precision Event Timer) in BIOS

Some have reported that enabling the HPET in the BIOS of the computer is required on their devices to successfully wake their machines from sleep. I haven't had this issues on the endpoints that I manage, but if you are having issues getting the above to work, give it a try. 

References

https://social.technet.microsoft.com/forums/en-US/c39f3759-76ab-4712-ae09-7ee102a94b9a/windows-10-task-scheduler-will-not-wake-computer?forum=win10itprogeneral

https://www.tenforums.com/tutorials/63070-enable-disable-wake-timers-windows-10-a.html

https://community.spiceworks.com/topic/1090437-disable-sleep-hibernation-standby-via-gpo

https://www.groovypost.com/howto/schedule-wake-sleep-windows-automatically/

https://docs.microsoft.com/en-us/windows-hardware/design/device-experiences/powercfg-command-line-options#option_waketimers