Conclusively stop wake timers from waking Windows 10 desktop

245

214

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.

seagull

Posted 2015-09-14T20:06:52.590

Reputation: 4 278

Answers

377

Summary

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.

Step 1: Disable wake timers for all power profiles

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.

Step 2: Disable the unruly reboot scheduled task

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.

Step 3: Check Wake Timers in PowerShell

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.

Step 4: Check what hardware can wake your PC

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.

Step 5: Check the Group Policy just to be completely sure

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

Step 6: Disable waking your machine up for automatic maintenance

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.

seagull

Posted 2015-09-14T20:06:52.590

Reputation: 4 278

Thank you. I have had a lot of trouble with the Reboot task waking the computer. I've tried your Step 2 above, I hope it will work. – Godsmith – 2015-11-02T21:00:00.720

2Glad to hear it's of some use to someone. I recommend going through all the steps personally but I guess that might be what's causing the issue for you. – seagull – 2015-11-02T21:58:27.670

17Thanks! I especially appreciated the robust rugged ruthless resolve to take ownership of the Reboot task definition file at the NTFS level and reduce the sneaky snaky sordid SYSTEM (ab)user to mere read & exec permissions. An appropriate no-nonsense approach to keep in mind should Microsoft decide to roll out further harmful hostile hand-holding machinations. As in the Boss' great song, this morning I awoke to an empty sky where the night before had been unsaved clouds of data in notepad and IE tabs. An OS sacrificing user data on the altar of Update & Reboot clearly fails its mission. – Lumi – 2016-01-13T10:53:11.807

Step 2 permissions dialog, my system shows that SYSTEM inherits permissions from higher up the file tree. I suspect I would need to turn off that inherited permission also. – Alan Baljeu – 2016-01-18T14:57:00.730

Correct, Alan - you need to disable inheritance on that file. I should edit that in. – seagull – 2016-01-19T08:53:15.863

8Although your answer is very comprehensive, seems effective, and I up-voted it, I think it could have been better written as several parts are very vague and/or confusing (especially to folks who aren't super Windows computer savvy). Case in point: What does the info at the link "make yourself the owner" (which is command-line based) have to do with right-clicking on the reboot task and selecting Properties? – martineau – 2016-01-21T13:58:04.273

3

For anyone with Windows 10 Home which doesn't have the group policy editor, you can modify the registry manually as described in this answer to accomplish the same thing.

– martineau – 2016-01-27T07:46:55.183

8Thank you for this answer. This is exactly the sort of behaviour I hate Windows 10 with all my heart for — changing settings back to what it thinks is nice despite me explicitly clicking otherwise. Happens with other stuff too like keyboard layouts. – Dav – 2016-03-11T10:49:58.910

No worries - glad it helped. – seagull – 2016-03-11T10:51:15.270

@martineau, the key from the accepted answer does not exist on my Windows 10 Home. I think that is for Vista.

– crokusek – 2016-03-27T05:56:28.360

1@crokusek: The linked answer does say "(you may need to create the WindowsUpdate and AU keys) and create a DWORD value named AUPowerManagement". I used the technique on one Windows 10 Home machine I have to do Step 5 of this answer — which is why I mentioned in one of my comments here. – martineau – 2016-03-27T13:18:15.360

2I love you. So comprehensive, such a relief. Sleep now... – Astravagrant – 2016-05-20T15:52:11.330

@seagull, Re "various Windows faculties will use different profiles"—wow seriously? What does that even mean? Also, is gpedit.msc available for home users of windows 10? – Pacerier – 2016-09-18T15:40:59.097

@Pacerier: my understanding is that yes, different elements of Windows – different services and tasks, etc – will use different power profiles, so disabling wake timers does nothing unless done on all three. While I do not believe Windows 10 home has access to the group policy editor, you do still have access to the task scheduler, so you should still be able to make some difference. – seagull – 2016-09-18T15:59:45.823

Thanks! <3 But one question: Which answer did you mean to link to on the "make yourself the owner" link? ( https://superuser.com/questions/60700/how-do-i-get-permissions-to-delete-files-on-windows-7 ) -- Would you mind updating with the specific answer linked instead of the question?

– Allen Pestaluky – 2016-10-02T15:31:57.230

http://i.imgur.com/Z3bkPpH.png The "Wake the computer to run this task" checkbox is checked but not changeable! What can I do to enable it for allowing me to uncheck it after? – sergiol – 2017-01-19T22:10:27.813

Sounds like a permissions issue. Try editing the file directly. It should be in C:\windows\system32\tasks if I recall. – seagull – 2017-01-20T00:56:47.003

2I made some of the changes but that didn't help. I just added a power strip to the computer (desktop) and put in in hypernate, then turn off the power at the power strip. Old school but there is no way Microsoft can beat that one ;-) – uwe – 2017-02-08T21:39:44.783

Also use powercfg -lastwake to find out the last wake trigger, in my case it was Veeam Endpoint Backup – Michael S. – 2017-02-27T04:09:43.920

5I cannot believe that users have to go through all these cumbersome steps just not to be disturbed by computers while they are sleeping. – Damn Vegetables – 2017-03-10T19:22:40.067

Can you expand on Step 3 a bit in detail? How do you "remove their permission to wake your computer"? – Yahreen – 2017-06-29T19:16:30.923

By doing the same thing for those tasks that you did with the Reboot task in step 2. – seagull – 2017-06-29T22:20:24.760

It has just woke me up from sleep, not just my computer. I hope whoever responsible in Microsoft eats dirt. I put the PC to sleep again and it woke just a while later. – Vlasec – 2017-09-14T03:03:54.277

13So I just upgraded to 1709 and can't get this Reboot-task to die. Even after becoming the sole owner of this task and having full permissions I can't change anything without providing the password for "S-1-5-18" - any ideao how I can kill this damn thing?! – MFH – 2017-11-16T22:22:01.923

1That's the SID for the LocalSystem account. Try opening explorer as NT AUTHORITY\SYSTEM with PsExec and then overriding it. – seagull – 2017-11-17T23:58:32.857

1Thanks. It's amazing the hoops you have to jump through to get your Windows computer to stay asleep. – Ashley Davis – 2017-11-21T07:12:29.033

@AshleyDavis I don't disagree. Equally, I have a strong suspicion, given this question's enduring popularity, that Microsoft are aware of its presence on the net. They could patch this if they wanted, but I think they leave this method as a reprieve for the power users. (It's still a horrible idea, MS. Let people sleep at night.) – seagull – 2017-11-21T10:19:07.973

5

@MFH I had that problem myself and I found the solution, see https://superuser.com/a/1285419/118910

– ohaal – 2018-01-14T15:17:21.730

1After an Windows update my PC was rebooting itself again. So I followed this description once again, but it did not work immediately. I let my PC hibernate and it did restart by itself.

It seems like doing one proper reboot after following the described steps solved this issue. – Icarus – 2018-02-14T06:32:20.697

I had to use the NSudo program to be able to modify the Reboot task at all. https://github.com/M2Team/NSudo

– Locane – 2018-03-15T18:06:15.527

2+1 even for teaching me about Ctrl+Shift+Enter in the Start menu. Didn't know about that. – Ryan – 2018-04-18T14:42:11.603

1Looks like after latest Windows 10 April 2018 Update there is a new task to wake up your PC: "\Microsoft\Windows\UpdateOrchestrator\ Schedule Retry Scan ready" – icl7126 – 2018-05-01T20:09:56.983

Using 17134 after the April update and Task Scheduler is telling me I don't have permission to disable Reboot, whether I run as Administrator or what. I can change the file's permissions with Command Prompt but Task Scheduler is locked. Can't UpdateOrchestrator's "AC Power Install" task in PowerShell either; also permissions related. Any way to circumvent this new layer of nuisance? – Augusta – 2018-06-12T19:41:11.977

this is not a 17134/1803 issue, this is something localised to your endpoint. i have heard no similar reports from other 1803 users including myself. – seagull – 2018-06-13T09:57:16.450

3If you are asked for a password for the "S-1-5-18" account when modifying Tasks, you need to start the Task Scheduler using sysinternals psexec as follows: .\PsExec.exe -i -s control schedtasks. – Karalga – 2018-07-12T10:07:13.403

that's really useful, @Karalga. i'm going to add it now. – seagull – 2018-07-13T20:45:59.237

1

update v1803 changed permissions for UpdateOrchestrator scheduled tasks and WU reboots can be disabled as system, using Sysinternals: psexec.exe -i -s %windir%\system32\mmc.exe /s taskschd.msc Credit to TrevorLaneRay https://answers.microsoft.com/en-us/windows/forum/windows_10-update/disable-update-orchestrator-from-waking-my/19272430-f41f-4947-904c-71ab34b220f0?page=2

– Alec Istomin – 2018-09-12T05:53:22.857

Just out of curiosity: Is it possible to create powershell script that automates these tasks? – uceumern – 2019-11-12T08:55:02.933

https://github.com/seagull/disable-automaticrestarts – seagull – 2019-11-13T12:53:00.340

I had to use the elevated permissions from modifying the Reboot task to also modify the Reboot_AC, Backup Scan, and Universal Orchestrator Start tasks to remove the permission to "Wake this computer to start this Task" in the same folder. – nyarasha – 2019-12-05T17:49:42.043

26

I now use this script to Conclusively stop wake timers from waking Windows 10 desktop:

# disable wake for enabled scheduled tasks that are allowed to wake
Get-ScheduledTask |
?{ $_.Settings.WakeToRun -eq $true -and $_.State -ne 'Disabled' } |
%{
    write-host $_
    $_.Settings.WakeToRun = $false;
    Set-ScheduledTask $_
}

# disable wake for devices that are allowed to wake (list of wake capable devices: powercfg -devicequery wake_from_any)
powercfg -devicequery wake_armed |
%{
    write-host $_
    if ($_ -notmatch '^(NONE)?$')
    { powercfg -devicedisablewake $_ }
}

# disable wake timers for all power schemes
powercfg -list | Select-String 'GUID' |
%{
    write-host $_
    $guid = $_ -replace '^.*:\s+(\S+?)\s+.*$', '$1'
    powercfg -setdcvalueindex $guid SUB_SLEEP RTCWAKE 0
    powercfg -setacvalueindex $guid SUB_SLEEP RTCWAKE 0
}

# disable wake for automatic updates and for automatic maintenance
'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\AUPowerManagement', 
'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\Maintenance\WakeUp' |
%{
    write-host $_
    $key = split-path $_
    $name = split-path $_ -leaf
    $type = 'DWORD'
    $value = 0
    if (!(Test-Path $key))
    { New-Item -Path $key -Force | Out-Null }
    if ((Get-ItemProperty $key $name 2>$null).$name -ne $value)
    { Set-ItemProperty $key $name $value -type $type }
}

As you can see, it more or less addresses all of the steps mentioned in this answer except for the scheduled task file permissions. However, since I intend to silently run this script upon every unlock/logon, I hope this will not be a problem at all.

mousio

Posted 2015-09-14T20:06:52.590

Reputation: 771

Is it a .bat script? – alm – 2016-06-18T13:48:47.803

6Looks like a PowerShell .ps1 script requiring administative permissions.

To disable the scheduled tasks properly, including permissions, use a combination of TASKEOWN, ICACLS, and SCHTASKS in a batch file. – psouza4 – 2016-06-18T16:24:42.427

Did not work for me :( – sergiol – 2017-01-19T22:00:26.537

The Get-ScheduledTask part of the script fails when it finds such tasks. Any idea how to solve it? – thisismydesign – 2019-06-23T21:11:13.933

@thisismydesign One might get a PermissionDenied or InvalidArgument error upon executing Set-ScheduledTask (as opposed to Get-ScheduledTask), which might be solved by running inside an elevated shell. Should the error(s) persist, then the script can be led to ignore these errors by specifying an error action, e.g. Set-ScheduledTask $_ -ErrorAction SilentlyContinue. – mousio – 2019-06-24T18:08:52.840

@mousio I think Set-ScheduledTask doesn't work the way you're using it (hence the InvalidArgument error). Also, if you ignore PermissionDenied errors it simply doesn't do what it's supposed to. – thisismydesign – 2019-06-25T12:34:37.017

@thisismydesign You could also perform $_ | Set-ScheduledTask but I expect the end result to be the same. About the PermissionDenied errors, I have not encountered such waking tasks. If you get these errors even while running it elevated, there is only one suggestion that comes to mind, and that is to perhaps try and schedule the script and run it with the SYSTEM account? – mousio – 2019-06-25T20:43:50.700

2

@mousio I had to run the script in an admin terminal in order to encounter those. The solution was to take ownership of them and grant full access to administrators. As for Set-ScheduledTask is don't think it takes a ScheduledTask object as a parameter. Did this actually work for you to modify tasks? Here's a reference from someone else reporting it: https://social.technet.microsoft.com/Forums/en-US/7764223b-abb4-437c-a5fb-94c1ef5112ec

– thisismydesign – 2019-06-25T21:34:43.230

@thisismydesign Found out some more: my Set-ScheduledTask $_ seems to be shorthand for Set-ScheduledTask -InputObject $_. However, I cannot find this parameter with man Set-ScheduledTask – not even after an elevated Update-Help – but typing the start of the parameter -in and pressing Tab does indeed complete its name for me!? The piped alternative ($t | Set-ScheduledTask) also goes back a long way. I guess you're right, it now seems more like an undocumented feature which might not work for all tasks :/

– mousio – 2019-06-26T16:13:37.870

@thisismydesign It is documented over at MS so it appears that the man pages need fixing. Also, thanks for sharing your solution (taking ownership and granting access seems to have sufficed)!

– mousio – 2019-06-26T16:23:36.507

Nice.. hopefully, I can polish up and share my solution in the coming days. – thisismydesign – 2019-06-26T22:32:48.943

11

I found the other answer incredibly helpful, and would just comment if I could, but I wanted to contribute a piece of software I quickly wrote to help with steps 3 & 4 found here:

https://github.com/Omniru/System-Wake-Manager/wiki/Home-&-Download

Hopefully it's of some use to some people.

enter image description here

enter image description here

You may see this pop up and have to click "More info" and then "Run anyway" (if you're not sure about it, feel free to check the source code, it is on github afterall): enter image description here

Eric

Posted 2015-09-14T20:06:52.590

Reputation: 143

1Nice work, Eric. – seagull – 2016-11-18T09:33:10.823

3So if it is this automatic maintenance scheduled task then why the heck can't it put the computer back to sleep after maintenance is done?! Then I would not have a problem with it – Vitas – 2018-01-18T19:22:29.493