After doing a fresh install of Windows 10 and updating to version 1909 I noticed that even if I used hibernate instead of sleep, it would wake up in the middle of the night and even sometimes just seconds after it went to sleep. It’s now been two days since I made the following changes and it’s been asleep each morning so I think I’ve finally stopped it from waking unexpectedly.
From an administrator command prompt after it has woken up, you can run
powercfg /waketimers and it’ll hopefully tell you which service name or task caused it to wake. Quite often I would find that it was the task “Microsoft\Windows\UpdateOrchestrator\Backup Scan” which had triggered it.
I figured this was probably an admin level task so I opened a Windows Powershell (Admin) prompt and ran
taskschd to open the Task Scheduler as Administrator.
After expanding the groups on the left to find the task (there are quite a lot of groups listed), I eventually located it and opened the properties window.
As with a few other scheduled tasks, under the Conditions tab the checkbox for “Wake the computer to run this task” was checked so that seemed obvious – uncheck the box and click OK. Unfortunately it’s not that easy. It then asks for a username and password for running the task.
Nothing you can enter here will actually work because it’s expecting the local system account as it says on the General tab.
After a bit of searching, I eventually found the answer. First go to https://docs.microsoft.com/en-us/sysinternals/downloads/psexec and download PsTools. Open the zip file and extract psexec or psexec64 to somewhere convenient.
Next open a command prompt (or powershell) and change to the folder you saved psexec to. Then run the following, changing psexec to psexec64 if that’s the one you’re using:
psexec.exe -i -s %windir%\system32\mmc.exe /s taskschd.msc
You should now be able to navigate to the Backup Scan task (or whichever one was listed), uncheck the box to wake the computer and press OK. There may be a few tasks that cause it to wake up so it may take a few days to find all of them.
After stopping all the tasks from waking the computer, I then found another reason for it waking – the network device. Open Device Manager, find your network card under Network adapters and open the Properties window. Check under the Advanced tab if present to see if there’s anything about Wake on LAN. On my onboard network adapter (a Realtek Gaming GbE Family controller), there were two settings. “Wake on Magic Packet” – leaving this enabled is fine, but the other is “Wake on pattern match”. I have no idea what pattern it’s matching, but setting it to disabled seems to stop it waking.