Recently after installing some updates, I noticed that my computer kept waking from sleep at midnight. This was especially frustrating when the machine was in sleep mode in my bag. When I opened the computer the next day, the batter would be dead and the machine will have hibernated.
I found a command line tool to configure power settings. I would not think you would normally use this tool to modify your power settings, but there are some interesting switches that can be helpful in my situation. I am sharing them here as much for anyone else’s benefit as for my own lack of memory!
This switch will display information about the last event that woke the computer from the sleep state. I found that sometimes this would not give me any useful information. Not sure why it would give more information on some events than others, but it is still useful.
Example: powercfg -lastwake
This switch returns a list of devices that meet the query criteria passed as flags to the switch. There are some really useful flags that can be used here. The one that I wound up using to get the information I needed was wake-armed. This flag lists the devices that are currently configured to wake the computer from any sleep state. There are flags that allow you to list devices that are configured to wake the computer from various levels of sleep.
Example: powercfg –devicequery wake-armed
In my case, I ran the –lastwake switch to see what caused the previous wake. This didn’t give me any information on the day I checked it. But when I ran the –devicequery switch, I noticed that my network card had been reset to wake the computer. I could have used the –devicequery switch to disable wake on that device, but instead I went into the device manager and disabled wake on the network card. Problem fixed.
Hopefully this will help someone else solve a similar problem sooner!