Wednesday 5 September 2018

sleep - Conclusively stop wake timers from waking Windows 10 desktop


How do you stop a Windows 10 Desktop waking up from the sleeping/hibernated power state without user intervention?


For lots of users this won't be an issue but, if you sleep in the same room as your PC, then having your machine wake up at 3:30AM to download updates is irritating.



Answer




There are a number of things that can affect this. I'm aware there are posts all over this site detailing various different ways to approach the issue; this post aims to consolidate them and add my own insight into the issue as someone affected by it themselves.


The fix outlined in Step 2 can also be used to stop Windows 10 from rebooting the machine after installing Windows Updates.


This fix works for the Fall Update (1709) as well. You will need to disable the 'Reboot' task again and re-configure the security permissions, though, because the update process replaces it.



Lazy tech-bloggers would have you believe this is the end of your search. While it's true that this step will eliminate a few errant shutdowns, there are a number of settings and configurations, particularly in Windows 10, that fail to respect this setting regardless of user intervention. Go to the Control PanelPower Options. From here, pick whatever power profile is first on the list and disable 'Wake timers'. Work through all profiles.


Power settings


Thanks to StackExchange user olee22 for the image.


On Windows 10, it is strongly recommended you fix this setting for all power profiles, not just the one you have chosen to use. Various Windows faculties will use different profiles; this improves your chances of not being woken up.



Note: I have created a PowerShell script that can be used to stop your Windows 10 system from rebooting. You can find it here: github.com/seagull/disable-automaticrestarts.


Windows 10's UpdateOrchestrator scheduled task folder contains a task called "reboot". This task will wake your computer up to install updates regardless of whether or not any are available. Simply removing its permission to wake the computer is not sufficient; Windows will just edit it to give itself permission again after you leave the Task Scheduler.


From your Control Panel, enter Administrative Tools, then view your Task Scheduler. Entering Task Scheduler


Task Scheduler


This is the task you want - under Task Scheduler LibraryMicrosoftWindowsUpdateOrchestrator. The most important things you want to do are:


Remove permission for task to wake PC Disable task


From here, you will need to alter the permissions for the task so that Windows cannot molest it. The task is located in C:\Windows\System32\Tasks\Microsoft\Windows\UpdateOrchestrator. It's called Reboot without a file extension. Right-click it, enter properties and make yourself the owner. Finally, configure it so that the following is shown:


Reboot file with only read permissions


Here the file is shown with read-only permissions for SYSTEM. Make it so that no account has write access, not even your own (you can always change permissions later if you need to). Please also ensure you disable any inherited permissions for the file from the Advanced button on this screen, to override any existing permissions on the root folder. This will 100% STOP Windows from messing with your changes after you've implemented them.


Once this has been set, you won't need to worry about that scheduled task any more.


If you don't have the Permissions to alter UpdateOrchestrator Tasks



Altering the UpdateOrchestrator's tasks now requires SYSTEM permissions, neither administrator nor TrustedInstaller permissions.



One of the ways of going around this is by:



  1. Installing Microsoft's own PsTools.

  2. Opening Command Prompt as and administrator and cd into your local PsTools folder.

  3. Executing:
    psexec.exe -i -s %windir%\system32\mmc.exe /s taskschd.msc

  4. Going to the UpdateOrchestrator and disabling the Reboot task(s), as previously mentioned.


Note for Windows 1709 (Fall Creators' Update)


The Windows installation process changes permissions for files, so make sure you go through this guide again after upgrading.


I have heard reports that a new task is made called AC Power Install which requires the same steps applied to it, but I have not seen this task produced on my own device after installing the 16299.192 (2018-01 Meltdown patch) update so I cannot advise with absolute certainty. The same steps as performed above should work on any task that has been introduced.



You have disabled wake timer functionality, but Windows 10 has a habit of not respecting that setting, so to be safe, we're going to run a PowerShell command to weed out all tasks that can, feasibly, wake your PC. Open an Administrative PowerShell command prompt (Start, type 'Powershell', Ctrl+Shift+Enter) and place this command in the window:


Get-ScheduledTask | where {$_.settings.waketorun}

Go through all the tasks it lists and remove their permission to wake your computer. You shouldn't need to worry about permissions like we did with Reboot; that was an outlying case.



Lots of USB hardware, when engaged, has the ability to wake your PC (keyboards often do when keys are pressed for example); wake-on-LAN is typically also an issue in this scenario. For the uninitiated, a common and useful feature of modern hardware is called 'Wake on LAN'. If your device is attached to a local network by way of a wired Ethernet cable (it doesn't work for Wi-Fi) you can send communications through that will wake your PC up when received. It's a feature I use often but it must be brought into line, as its default behaviour is far too overzealous.


Enter the following command into an administrative command prompt:


powercfg -devicequery wake_armed

Command prompt output of command


From here, find the devices in your Device Manager (Control Panel) and, under the Power Management tab, remove their ability to wake your computer up. If you have network interface cards that you want to keep Wake-on-LAN for, enable Only wake this device if it receives a magic packet as opposed to waking up for all traffic sent its way.



Right-click your Start menu and select Run. Type in GPEdit.MSC. Find the following setting under Computer ConfigurationAdministrative TemplatesWindows ComponentsWindows UpdatesEnabling Windows Update Power Management to automatically wake up the system to install scheduled updates. Double-click it and set it to Disabled.


Disabling Windows Update wake functionality



Someone at Microsoft has a sense of humour for this one. If you're woken at night by your PC, the one thing you want to hear more than anything else is the hard drive crunching and grinding as it does a nightly defragmentation. Disable this feature by finding the Security and Maintenance section of the Control Panel. From there, expand Maintenance and look for the link to Change Maintenance settings.


Disable automatic maintenance


Set the time to something more sociable (7PM is fine) and disable the machine's ability to wake itself up for the task.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...