Methods to Resolve and Diagnose Sleep Problems with Windows 7

powercfg -laswake.jpg
While getting sleep to work reliably with windows 7 is much easier than it was in the days of windows XP, it still can take a little bit of work to get the settings rights. One thing that makes it easier is knowing when the computer went to sleep and then when, and what woke it up. There are several methods to accomplish this task. I will be covering three in this guide. The first is to run powercfg -lastwake from a comand prompt, second is to create a custom view in event viewer and the last method is to use StandbyTracker, a tool created by Andrew Van Til, which will log the sleep events as well as log the results of powercfg -lastwake on each resume. This guide will cover each in that order.  First up is using the command prompt…

Command Prompt

Open command prompt and type in powercfg -last wake. This will output the results as to the most recent device that was responsible for the waking up the computer.
This method can be very helpful as it will show what device most recently woke up the computer, however it does not show how long the computer was asleep or any other previous sleep and wake cycles for this I use a custom view in the event viewer.

Event Viewer

First for those who have not used the event viewer built into windows 7, it is a very powerful tool for debugging many problems in windows 7. This guide will create a custom view showing when the computer went to sleep and then when and what woke the computer up.
To start open up event viewer
 Start Menu to open event viewer
Then, in the event viewer click on “create custom view in the left tab.
create custom view
This screen opens up the wizard to create a new custom view which will allow you to select which error logs should be displayed. For this particular guide we are going to select error logs by source, choosing “Kernal-power” and “power-troubleshooting” respectively. Then we are also going to limit the display to only who event ids 1 and 42 as these are the event ID’s relating to sleep states.

Click the radio button for by source, and then select Kernal-power and power-troubleshooting
 Select Source
Then click where it says <all event IDS> and type 1, 42.
Select ID's

Press ok
Next click ok this will prompt you to give the view a name and a description, I like to use sleep events as the name.

Now you have a new custom view which contains two events. One which will show when the computer went to sleep and the other that will show when the computer woke up. It will also provide information as to why the computer woke up.

Custom View

Standby Tracker

Standby Tracker is a handy little tray application that will log each power event, and in addition will execute the over mentioned powercfg -lastwake and add that output to the log. Below is a screenshot of a sample output from the program.

Standby Tracker

Standby Tracker can be downloaded here

Well in a nutshell these are some methods to track down sleep problems. Please comment if you know of any others.

  • I had a super annoying sleep

    I had a super annoying sleep problem on my system.  I purchased a NAS to have MCE save to and then found that the network connections to the NAS are preventing sleep from occurring.  No amount of
    ‘powercfg -requestsoverride’ would resolve the issue either.

    What I finally came up with is to create scheduled tasks that will sleep the pc around 2 am on weekdays and 3am on weekends.  I get home around 9:30pm so this gives me plenty of time and if I fall asleep without sleeping the pc manually this takes care of it.  The next days shows will be take care of by a wake timer and the cycle will repeat.  Easy Peasy!!