Windows 10: force to sleep at night, but allow wake up for Windows Updates
Posted by jpluimers on 2019/03/04
I do not like a machine that sleeps after a certain amount of inactivity as I might have a long running job going on.
Usually however, I do like to have a machine off at night, even if I forget to put it asleep.
Exceptions for sleeping are just two:
- automatic back-up schedule
- allowing Windows Updates
Luckily you can tell Windows 10 to allow for all cases.
Enabling wake-up during Windows Updates
Note I’m not fully sure which BIOS settings you need to enable – if any- to have this work on all systems. Wake up works on my machine for these [WayBack]
psshutdownparameter combinations:
psshutdown.exe -h -t 0(Hibernate)psshutdown.exe -d -t 0(Suspend)It fails with these:
psshutdown.exe -s -t 0 -f(Shutdown without poweroff)psshutdown.exe -k -t 0(Poweroff)The odd thing: Wake-on-LAN can usually wake up the last two.
This is done with the gpedit.msc (via [WayBack] How to prevent Windows 10 waking from sleep when traveling in bag? – Super User, thanks xxxbence)
Follow this path:
Local Computer PolicyComputer ConfigurationAdministrative TemplatesWindows ComponentsWindows UpdateDouble click
Enabling Windows Update Power Management to automatically wake up the system to install scheduled updatesto show the below dialog.Enable it:
so it looks like this:
Forcing sleep (in my case hibernate) using the Task Scheduler
In Windows 7..10: disable shutdown/hibernate/sleep/restart from UI I wrote about shutdown /h /f to hibernate a machine. You can force to run this from the taskschd.msc (Windows Task Scheduler):
I wanted history for tasks, so I started
taskschd.mscas Administrator, then on the rightActions Pane, I clicked onEnable All Tasks History:
also explained in [WayBack] How can I enable the Windows Server Task Scheduler History recording? – Stack Overflow and can be verified/set on the console as well:
- Get as any user:
wevtutil get-log Microsoft-Windows-TaskScheduler/Operational- Set as Administrator:
wevtutil set-log Microsoft-Windows-TaskScheduler/Operational /enabled:trueI named the task
__ sleep at 2300with these settings:Ensure the
Program/scriptitself isshutdownand the parameters are/h /f:
–jeroen








also explained in [



Leave a comment