I recently received the gift of a new laptop at the office and let’s face it, what geek doesn’t love new hardware?

While setting up this Windows 7 machine I ran into a small snag; it wouldn’t hibernate or go to sleep. I have to say that the stability improvements to hibernate and sleep that were introduced with Windows 7 have meant that I hardly ever reboot my laptop and rarely run into problems. So although this refusal to stay down did bring up memories of one of my favorite children’s books, you can imagine that it was frustrating to ask the system to go to sleep only to have it wake itself up again seconds later.

Fortunately, even on Windows…

There’s an app for that!

A quick search turned up the powercfg utility which was just what I needed.

Running powercfg -devicequery wake_armed from a command prompt will list the devices that are authorized (i.e. “currently configured”) to wake your machine. This puts you in the position to call powercfg -devicedisablewake devicename where you can substitute for devicename an entire line copied from the results of your devicequery. Here is the content from my shell session:

After doing this for each of the devices returned from my query, I put the machine to sleep and it stayed that way - that makes powercfg my new fat cat.

Even better, this is just scratching the surface of what powercfg can do. If you’re a geek running Windows and haven’t explored the low-level system tweaking supported by this tool, go try it.

And sleep well.