Many devices are capable of “waking up” the computer, and often I find my computer has decided to wake itself up in the middle of the night because of one of them.
(See also: “Computer wakes up for no reason“)
You can dig through Device Manager to find and disable the “Allow this device to wake the computer” options, but this is tedious and also difficult if you don’t know which device to change. Windows also has this neat “trick” where if you disable wake up on a device, and then plug it into a different USB port, Windows will see it as a *different* device which it then enables wake up for again.
A simple way to see all the devices that will actively wake up your computer is to run the following command:
powercfg -devicequery wake_armed
This will show you which devices will actively be able to wake your computer. Typically you will see entries for keyboard, mouse, and network adapter. I usually disable the mouse and keyboard ones as a slight bump of my desk is enough to trigger the mouse to cause the computer to wake up.
To disable, you can either find that device in device manager, go to the “Power Management” tab and untick the “allow this device to wake the computer”
Another method is using powercfg again, this time you will need to use an elevated “Run as Administrator” command prompt:
powercfg -devicedisablewake "[devicename]" e.g. powercfg -devicedisablewake "HID-compliant mouse"
If you see a result like “Wake History Count – 0” then it means it was last woken normally using the power button. If it was woken by another device it will tell you which device it was and you can then disable it. The image above shows my computer was last woken by the network card from a “Wake on LAN” (WOL) request.