Powercfg Gets Sleepy

Control hibernation with Vista/Server 2008's revitalized power-management utility

Executive Summary:
The Windows Vista/Windows Server 2008 incarnation of the Powercfg power-management utility lets you bypass your system's annoying "hybrid sleep" behavior. Here's how to make it work.

Last month, in "Powercfg Revisited" (InstantDoc ID 102005), I introduced Windows Vista/Windows Server 2008's command-line power-management tool, Powercfg, noting that although it first appeared in Windows XP SP2, its Vista and Server 2008 incarnation changes almost everything, making it a nearly new tool that's worth a look. (For a useful Powercfg tip that I didn't have room for last month, see the sidebar "Powercfg Plus WinRS.") This month, let's dig a little more deeply into what's different about the new Powercfg.

Hibernation Consternation
In XP, you could configure a system, after a certain amount of inactivity, to go to sleep (i.e., the screen shuts off, the hard disk stops, the CPU's clock rate drops considerably, but the system still consumes some power) and, after a further period of inactivity, to hibernate (i.e., the system writes the current state of the system's RAM and processor registers to disk, then shuts down and stops using power). I was accustomed to that kind of control, so when I sat down to tweak my new Vista machine's sleep and hibernation behavior, I was surprised to find that the word "hibernate" didn't appear in the Control Panel Power Options applet.

Check it out for yourself: On your out-of-the-box Vista machine, open Control Panel and access the Hardware and Sound area. Under Power Options, click Change power-saving settings. Under your selected power plan, click Change power settings, then Change advanced power settings in the resulting dialog box. On the Advanced settings property page tab that appears, click the plus sign next to Sleep and you'll see just one option—Sleep after. After some exploration, you'll see that you can control only how many minutes of inactivity Vista should wait before putting your system to sleep. By default, Vista blends the notions of sleep and hibernation into what Microsoft calls "hybrid sleep." If the system sleeps so long that it's almost out of power, it automatically hibernates itself and shuts down its power.

This functionality isn't terrible—I'm sure Microsoft had its heart in the right place when it came up with it—but I don't trust it. If I plan to walk around with my laptop for, say, 30 minutes, I've always preferred to put it into hibernation so that I don't have to worry about it overheating in the laptop bag because of its reduced-but-still-active power use. (I've seen this happen.) That way, I also know that my system isn't draining its battery while it's stowed away. I can't perform that sort of configuration on a new Vista system, though: Microsoft's notion of hybrid sleep tries to "idiot-proof" the whole sleep/hibernation concept, and the result is that I'm the one that's overheated.

Powercfg to the Rescue
Fortunately, there's a Powercfg switch in Vista that lets you configure Vista's power-saving functionality the way you want. Microsoft calls it "turning on hibernation"—a misleading label, in my opinion, because it's not hibernation that's enabled or disabled but rather your ability to control when hibernation occurs. Anyway, there's no Vista GUI that lets you "enable hibernation," but you can do it from an elevated command prompt:

powercfg -h on

(Note that this command might cause Vista to create a large hiberfil.sys file, which the system uses to store the contents of RAM during hibernates.) Once you run that command, reopen the Advanced Settings dialog box and you'll see that the Sleep option now has three choices rather than one: Sleep after, Allow hybrid sleep (a yes/no question that lets you choose to employ hybrid sleep), and Hibernate after. At this point, I can now tweak my system's sleep and hibernation behavior independently—a victory for personal choice!

In theory, your system might lack the hardware necessary to support the whole notion of hibernation. In that case, all the Powercfg commands in the world won't have any effect. I'd say that's a pretty unlikely scenario on any modern hardware, however, and I can't really imagine someone running Vista on a system that isn't modern.

Powercfg Plus WinRS
Another aspect of Powercfg's usefulness involves WinRS (winrs.exe). You might recall from a previous column that WinRS is the new, secure remote command shell for Vista and Server 2008, as well as—with the hotfix from Microsoft's Knowledge Base article "An update is available for the Windows Remote Management feature in Windows Server 2003 and in Windows XP"—XP and Windows 2003. As with Telnet, its insecure older relative, one of WinRS's big selling points is that it provides a remote control tool that requires only a tiny amount of bandwidth. So, Powercfg in conjunction with WinRS offers you a minimum-bandwidth way to remotely control Windows power management.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.