ShawnAdministrator
(KiX Supporter)
2004-07-20 01:07 AM
Changing power mgmt settings (monitor)

Guys ... I have been exporting and poking and proding and snapping for what feels like weeks now, trying to figure-out the "magic" bullet for changing power mgmt settings on the user's behalf. Here's my story:

We're almost half-way through a very large XP deployment. We "went-out" with screen-saver set to 10 mins and monitor power-off set to 20 mins (way too short I know, but it wasn;t my call).

Now of course, we want to move screen-saver to 30 mins (still too short imho but none-the-less) and monitor power-off to 1 hour.

Screen saver is a slam-dunk GPO - no probs. Monitor power-off is another matter, power settings (like printers) from a registry standpoint, seems to have one foot in HKCU and one foot in HKLM. In all my snapping and poking - i am getting horrible and inconsistent results.

Question is, has anybody "been there" yet ? The other thing is - has anybody played with, or been able to get powercfg.exe running under Windows XP (not 2K3, where its from (iirc)) ...

Any thoughts, help appreciated.

-Shawn


AllenAdministrator
(KiX Supporter)
2004-07-20 06:28 AM
Re: Changing power mgmt settings (monitor)

Some time ago I was looking into do the very same thing, but as it turned out, the issue was dropped and we never needed a solution. The best link/info I found, albeit Win2k, was here: Windows 2000 Power Options Always On Registry setting (The suggestions are down the page a little ways.)

Hope this helps.


masken
(MM club member)
2004-07-20 01:45 PM
Re: Changing power mgmt settings (monitor)

regmon doesn't do it?

ShawnAdministrator
(KiX Supporter)
2004-07-20 02:35 PM
Re: Changing power mgmt settings (monitor)

You would think regmon (i use regedit->export, because I am old), would do it but if you read Al's link to thread above, you can see the frustration level of trying to set this setting on the user's behalf (apparently this stuff needs a wkstn restart!) ... excellent link Al, printing it off now.

Why oh why does Microsoft make it so hard to manage settings like these. Why do they continue to use registry binary blobs when they know they're not GPO friendly, or even scripted poke friendly. sheesh.



ShawnAdministrator
(KiX Supporter)
2004-07-21 02:55 PM
Re: Changing power mgmt settings (monitor)

Update:

Finally broke-down and opened-up a premier support ticket on this issue. Mostly so that I could hopefully get my hands on this rumored Windows XP version of powercfg.exe.

Talked with a very knowledgable MS "server" dude in Dallas by the name of John, and told him our woes, he was very sympathetic. I mentioned the "two" approaches I have been talking up till now, to set power settings on the user's behalf (in an automated fashion). One being a rather large REGPOKE (12k in total) that needed a machine restart to take effect, and the other being this rumored POWERCFG.EXE that is only available in XP SP2 and Windows Server 2K3.

John went right for the "powercfg.exe" approach. I told John that I tried the 2K3 version of powercfg.exe but was getting DLL errors with it on Windows XP Sp1. After much tippy-tapping on his keyboard, and hmmming and hahhhing, he said he found an "older" version of powercfg.exe on his internal MS tools share.

He mailed it to me and I must say, its a beautiful thing. I have appended the cmdline help to this post. I told John that I also heard tell that this tool required at least Power User priviledge to run. Sure enough, I ran it as a user and got a priviledge violation. All was not lost - I remembered reading Al_Po's thread about the trick to getting this working. Have to change the permissions on one HKLM registry to Users FullControl ... heres the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg

Soon as you do that, run powercfg.exe and Bob's your uncle. And it doesn't even require a logoff or restart! You now can fully manage all the power settings on the wkstn from your login script. By the way, before this MS tool there was a third-party package that was for sale, that did this very thing ...

Anyway, for anyone deploying new wkstns going-forward - might be wise to preset this key and slap in this powercfg.exe tool as some insurance.

-Shawn


Code:

E:\>powercfg.exe /?

POWERCFG [/LIST | /QUERY [name] | /CREATE name | /DELETE name |
/SETACTIVE name | /CHANGE name settings |
/HIBERNATE {ON|OFF} | /EXPORT name [/FILE filename] |
/IMPORT name [/FILE filename] | /GLOBALPOWERFLAG {ON|OFF} /OPTION flag |
/BATTERYALARM {LOW|CRITICAL} [settings] | /?]

Description:
This command line tool enables an administrator to control
the power settings on a system.

Parameter List:
/LIST, /L Lists the names of existing power schemes.
/QUERY, /Q Displays the configuration of the specified power scheme.
If no name is specified, the configuration of the currently
active power scheme is displayed.
/CREATE, /C Creates a power scheme with the specified name. The new
scheme is created with the properties of the currently
active scheme.
/DELETE, /D Deletes the power scheme with the specified name.
/SETACTIVE, /S Makes the power scheme with the specified name active.
/CHANGE, /X Changes settings of the specified power scheme. Additional
switches specify the changes as follows:
/monitor-timeout-ac <minutes>
/monitor-timeout-dc <minutes>
/disk-timeout-ac <minutes>
/disk-timeout-dc <minutes>
/standby-timeout-ac <minutes>
/standby-timeout-dc <minutes>
/hibernate-timeout-ac <minutes>
/hibernate-timeout-dc <minutes>
/processor-throttle-ac <throttle>
/processor-throttle-dc <throttle>
AC settings are used when the system is on AC power.
DC settings are used when the system is on battery power.
Setting a timeout to zero will disable the corresponding
timeout feature. Supported throttle settings are NONE
CONSTANT, DEGRADE, and ADAPTIVE.
/EXPORT, /E Exports the power scheme with the specified name to a
file. If no filename is specified, the default is
SCHEME.POW. This additional parameter is supported:
/FILE <filename>
/IMPORT, /I Imports the power scheme from a file under the specified
name. If no filename is specified, the default is
SCHEME.POW. If a scheme with that name already exists, it
is replaced with the new one. This additional parameter
is supported:
/FILE <filename>
/HIBERNATE, /H Turns the hibernation feature on/off. Hibernation timeout
is not supported on all systems that support hibernation
/NUMERICAL, /N Allows the power scheme to be operated upon to be specified
using a numerical identifier. When using this switch, in
place of the name of the power scheme on the command line,
specify its numerical identifier. This switch may be used
in combination with the /QUERY, /DELETE, /SETACTIVE,
/CHANGE, /EXPORT, and /IMPORT commands.
/GLOBALPOWERFLAG, /G {ON|OFF} Turns one of the global power flags on/off.
Valid flags (to be used after "/OPTION ") are:
BATTERYICON: Turns the battery meter icon in the
system tray on/off.
MULTIBATTERY: Turns on/off multiple battery display
in system Power Meter.
RESUMEPASSWORD: Prompt for password on resuming the
system.
WAKEONRING: Turn on/off wake on ring support.
VIDEODIM: Turn on/off support for dimming video
display on battery power.
/AVAILABLESLEEPSTATES, /A Reports the sleep states available on the
system. Attempts to report reasons why sleep states are
unavailable.
/BATTERYALARM, /B {LOW|CRITICAL} Displays or configures the specified
battery alarm. Using this option without any switches will
display the current settings.
The following switches can be specified:
/activate <on|off>
Enables or disables the alarm.
/level <percentage (0 - 100)>
The alarm will be activated when the power level
reaches this percentage.
/text <on|off>
Turns the text notification on or off.
/sound <on|off>
Turns the audible notification on or off.
/action <none|shutdown|hibernate|standby>
Specifies the action to take when this alarm goes
off. Not all actions are always available.
/forceaction <on|off>
Force stand by or shutdown even if a program stops
responding.
/program <on|off>
Specifies whether the system will run a program
when the alarm goes off. When this option is used,
the output will be the taskname that can be used
with schtasks.exe /change to configure the program.
/HELP, /? Displays information on command-line parameters.

Examples:
POWERCFG /LIST
POWERCFG /QUERY scheme
POWERCFG /QUERY
POWERCFG /CREATE scheme
POWERCFG /DELETE scheme
POWERCFG /SETACTIVE scheme
POWERCFG /CHANGE scheme /monitor-timeout-dc 15
POWERCFG /CHANGE scheme /monitor-timeout-dc 0
POWERCFG /HIBERNATE on
POWERCFG /EXPORT scheme /file file
POWERCFG /QUERY number /NUMERICAL
POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
POWERCFG /AVAILABLESLEEPSTATES
POWERCFG /BATTERYALARM low
POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 6 /ACTION hibernate




Hope this helps someone down-the-road.

-Shawn


ShawnAdministrator
(KiX Supporter)
2004-07-21 03:27 PM
Re: Changing power mgmt settings (monitor)

By the way, the "other" guys at the office here call our bulletin board the "KORG Collective". They're always asking me to "ask the KORG Collective" .... hehee



AllenAdministrator
(KiX Supporter)
2004-07-21 04:32 PM
Re: Changing power mgmt settings (monitor)

Awesome. I'll look for you on the instant messenger to get a copy of the powercfg.exe, as you never know when that might come up again for me.

Sealeopard
(KiX Master)
2004-07-22 03:02 AM
Re: Changing power mgmt settings (monitor)

Did you investigate whether just changing the permissions on the HKLM key would enable you to do the other registry hacks without the executable? Just curious whether it might have just been a permissions problem when hacking the registry directly.

JochenAdministrator
(KiX Supporter)
2004-07-22 08:33 AM
Re: Changing power mgmt settings (monitor)

The KORG Collective ?

Yoda of Korg I am. Futile is resistance. Assimilate you we will.


BentWookie
(Lurker)
2005-05-02 03:30 PM
Re: Changing power mgmt settings (monitor)

Shawn,
Is there a way for you to send me the "older" powercfg.exe? I need to change the power settings on XP SP1 computers and the powercfg.exe from SP2 won't work.
Thanks


ShawnAdministrator
(KiX Supporter)
2005-05-02 04:14 PM
Re: Changing power mgmt settings (monitor)

sure thing, will dig it up and email you.

masken
(MM club member)
2005-05-02 04:24 PM
Re: Changing power mgmt settings (monitor)

Me me me

Really nice piece of information here... it's a common mess for environments where users have no privs... Another catch is to disable the power save for NIC's, which otherwise takes the PC in Offline mode...


ShawnAdministrator
(KiX Supporter)
2005-05-02 04:24 PM
Re: Changing power mgmt settings (monitor)

just sent you a personal message on this bbs, with the details on where I put it.

-Shawn


ShawnAdministrator
(KiX Supporter)
2005-05-02 04:32 PM
Re: Changing power mgmt settings (monitor)

Mats,

Sent you a pm too

-Shawn


Chris S.
(MM club member)
2005-10-12 02:37 PM
Re: Changing power mgmt settings (monitor)

I just wanted to post an update to this thread. You can use the SP2 version of powercfg.exe on XP SP1 if you copy xpsp2res.dll over as well. Additionally, I copied these two files over to a Windows 2000 SP4 workstation and it works!

rohm
(Fresh Scripter)
2006-04-23 03:28 PM
Re: Changing power mgmt settings (monitor)

Hi,

did you get the file "powercfg.exe" for the XP SP1 version. iīm also looking for this file, but i canīt find it anywhere. i hope you can send it to me also. please send it to frank.rohm@gmx.de

thanks from frank


Les
(KiX Master)
2006-04-23 05:36 PM
Re: Changing power mgmt settings (monitor)

The EXE should be part of the OS. Not sure if you need to install SP2 to get it but it is on all my SP2 boxes.

ShawnAdministrator
(KiX Supporter)
2006-04-23 06:11 PM
Re: Changing power mgmt settings (monitor)

I fired-off the SP1 version to Frank in an email. He reports that its works a charm.