This problem requires several steps.
First, edit your BIOS settings (before windows boots). Go to advanced power management options (the name may be different for your motherboard) and disable various options such as Wake on LAN. If you have an option "deep sleep" there, enable it (this option allows waking only after the power button is pressed). In boot options, disable "fast boot" for easy access to BIOS (not related to sleep).
If you enabled the "deep sleep" option, then go to "Control Panel" --> "Power options" --> "Change settings" for your current power management plan, then select "Change additional settings" (or "Advanced settings"). Set "what power button does" to "sleep" (Note that now you will have to press and hold the power button for several seconds if you want to shut down the computer the hard way.)
Go to
Control Panel ->System and Security->Action Center->Maintenance ->Change maintenance settings
and uncheck the option "Allow scheduled maintenance to wake up my computer at the scheduled time"
Launch Windows PowerShell as admin and enter the following script (I don't remember where I found it, big credit to the original writer). This script disables all wake the computer to run this task options in Windows task scheduler:
Code:
Get-ScheduledTask | ? { $_.Settings.WakeToRun -eq $true -and $_.State -ne "Disabled"} | % { $_.Settings.WakeToRun = $false; Set-ScheduledTask $_ }
Press Enter to run it (you won't see anything).
Launch Windows Command Prompt as admin and run this command (copy, paste, and press Enter):
Code:
for /F "tokens=*" %A in ('powercfg -devicequery wake_armed') do powercfg -devicedisablewake "%A"
This command disallows any devices to wake the computer. Now you can verify that the above actions worked.
While in command prompt, enter the following command to see if any devices are allowed to wake the computer:
Code:
powercfg /devicequery wake_from_any
also this command:
Code:
powercfg /devicequery wake_armed
also:
Code:
powercfg /waketimers
Finally, in the future, to find out which device/task woke the computer the last time, type this command in Windows Command Prompt (run as admin):
Note that sometimes, this action will tell you nothing about who woke the computer (probably some deep system process). In this case, the Windows Event Viewer will also show you a wake event but will not tell you who did it. The above plan can prevent such anonymous waking.