Back in 2009, I wrote a post related to issues of mutating power settings in Windows XP Media Center (I’ve got the Power! … but not over power properties?!). Since then I have seen the problem also on Windows XP Professional, and on multiple manufacturers laptops (HP, Gateway and Dell). After digging a little further, it seems the problem is related to using a laptop as a host for  RDC connections for multiple user accounts, which exposes a design strategy in Windows XP that conflicts with this use.

The power properties are strange.  Instead of being stored at the local machine level in the registry, they are stored at the user level.  There is a setting for the default user, and an override for each user account (which initially is only the same as the default).  That means that user A can choose to enable hibernation, while user B can choose not to.  That’s a strange design choice to me.  I can only assume that a user case was drawn up that most laptops are “personal”, only one user account exists for it, and it’s predominant use will be on demand use (i.e. not continuously available).  So the default was designed around this case.

Since I use at least two laptops with multiple user accounts in a continously-on mode, and have them sitting under a desktop with the lid always closed, the default Microsoft chose is what is causing me continuing problems.  I can set the proper power properties while I am logged on but, without changing the global user defaults, the next user will inherit wrong settings.

Knowing this now, the best way to establish the power scheme on a freshly-paved laptop to be used in this mode is…

  • Setup the laptop with a new power scheme definition designed for its operation, and set that new power scheme as the active power scheme.
  • Open RegEdit, and export this branch to a file: HKEY_CURRENT_USER\Control Panel\PowerCfg
  • In the file just created, change all references of HKEY_CURRENT_USER\ ..to.. HKEY_USERS\.DEFAULT\
  • Import this file into the registry.

This will set the default to the proper value, and every user who initially logs on from this point forward will inherit those default setting into their account.

Still, this does not solve the problem of a user logging on, changing their settings, and causing the laptop to initiate sleep, standby or hibernation; thereby taking the laptop offline.  One way that can be addressed is with permissions on the registry branch.  Still, most people aren’t that interested in power settings, especially when they login to a computer they don’t see or manage.

FWIW: If you’d like to reset the power settings to a fixed profile every time a user logs on, you can set this batch script to execute at logon.  It will create a schema for the power settings, program the settings, and make that schema the active one.  It will at least undo any tinkering done by a user the next time they log off.

@echo off
REM
REM This script sets the power properties to prevent standby or
REM hibernation while the computer is running on AC power.
REM It creates a power scheme called AlwaysOn-RDC-Multiser, and
REM sets the system to use this power scheme.
REM
REM This script is intended for laptops or even desktops, which
REM are always running and are used as dev "slop-boxes" to test
REM prototype code or are doing heavy-duty R&D work in a "not 
REM ready for production" capacity.  It prevents the computer from
REM going into standby, sleep or hibernation, regardless of the
REM user's preference.
REM
REM ** This script needs to be run as a startup script
REM ** when a user logs in.  To do this:
REM  1) Start / Run
REM  2) gpedit.msc
REM  3) Drill down to Local Computer Policy /
REM       Computer Configuration /Windows Settings /
REM       Scripts (Startup / Shutdown)
REM  4) In right panel, double-click Startup.
REM  5) Click the Add button.
REM  6) In the Script Name, enter the full path for this file.
REM  7) Leave the Script Parameters blank and click OK.
REM
 
powercfg.exe /C "AlwaysOn-RDC-Multiser"
 
powercfg.exe /H ON
 
REM ** CORE SETTINGS **
powercfg.exe /X "AlwaysOn-RDC-Multiser" /monitor-timeout-ac 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /disk-timeout-ac 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /standby-timeout-ac 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /hibernate-timeout-ac 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /processor-throttle-ac NONE
REM ** CORE SETTINGS **
 
powercfg.exe /X "AlwaysOn-RDC-Multiser" /monitor-timeout-dc 10
powercfg.exe /X "AlwaysOn-RDC-Multiser" /disk-timeout-dc 10
powercfg.exe /X "AlwaysOn-RDC-Multiser" /standby-timeout-dc 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /hibernate-timeout-dc 0
powercfg.exe /X "AlwaysOn-RDC-Multiser" /processor-throttle-dc NONE
 
powercfg.exe /G ON /OPTION BATTERYICON
powercfg.exe /G ON /OPTION MULTIBATTERY
powercfg.exe /G OFF /OPTION RESUMEPASSWORD
powercfg.exe /G ON /OPTION WAKEONRING
powercfg.exe /G ON /OPTION VIDEODIM
 
powercfg.exe /S "AlwaysOn-RDC-Multiser"