Check the reason the computer resumed from hibernation

≡放荡痞女 提交于 2019-11-30 20:12:21

1/ You can query the Windows Event Log to see what caused the computer to wake up:

  var log = new EventLog("System");
  var wakeUpEntry = (from entry in log.Entries.Cast<EventLogEntry>()
    where entry.Source == "Microsoft-Windows-Power-Troubleshooter"
          && entry.InstanceId == 1
    orderby entry.TimeWritten descending
    select entry).First();

  Console.WriteLine("{0}", wakeUpEntry.Message);

The message has a "Wake Source" entry ("4USB Root Hub" for instance) that you can parse if you really want to do it programmatically.

2/ You can check if any Windows or external program has set a wake timer on the system with this command:

powercfg -waketimers

If neither command (yours nor this one) shows anything, most of the possible causes have been eliminated.

3/ You can even disable wake timers completely on this machine. In Windows Power Options, Plan Settings, Advanced Plan Settings, Disable Allow wake timers under the Sleep section. I'm not sure if Windows Scheduled Maintenance is affected by this, but you can also turn it off, of course.

4/ Another safety: make sure no devices in the BIOS settings are allowed to wake the PC up, whenever it's configurable.

After following the instructions in this article (particularly seeing what last woke it up with powercfg -lastwake) I found a mention (in this linked article) that:

Windows 10 has a new “feature” that wakes the computer up for what they call “important wake timers”, and you will want to disable that if your computer is waking up all the time. Head into Power Options just like we show above, and then find Sleep -> Allow wake timers -> Plugged in and change the setting from Important Wake Timers Only to Disable.

(emphasis mine)

Pretty sure that's the culprit that wakes my computer from hibernation, but haven't confirmed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!