The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,565 other followers

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 [WayBackpsshutdown parameter 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 [WayBackHow to prevent Windows 10 waking from sleep when traveling in bag? – Super User, thanks xxxbence)

Follow this path:

  1. Local Computer Policy
  2. Computer Configuration
  3. Administrative Templates
  4. Windows Components
  5. Windows Update

Double 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.msc as Administrator, then on the right Actions Pane, I clicked on Enable All Tasks History:

 also explained in [WayBackHow 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:true

I named the task __ sleep at 2300 with these settings:

Ensure the Program/script itself is shutdown and the parameters are /h /f:

–jeroen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: