Freigeben über


powercfg - Useful if you know the GUIDS!

So I have been doing some work with powercfg - and found it a very useful tool for scripting power management options during builds. This command utility is installed with Windows Vista and you can use it to control power settings and configure computers to default to Hibernate or Standby modes.

The following command-line options are available for powercfg.

powercfg [ -l ] [ -q ] [ -x ] [ -changename ] [ -duplicatescheme ] [ -d ] [ -deletesetting ] [ -setactive ] [ -getactivescheme ] [ -setacvalueindex ] [ -setdcvalueindex ] [ -h ] [ -a ] [ -devicequery ] [ -deviceenablewake ] [ -devicedisablewake ] [ -import ] [ -export ] [ -lastwake ] [ -? ] [ -aliases ] [ -setsecuritydescriptor ] [ -getsecuritydescriptor ]

Full details of the switches can be found here

So having delved into this utility a little more - here are my top commands for powercfg ready to use in your scripts:

sets the power configuration to High Performance
powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

tweaks the basic power settings
powercfg -change -hibernate-timeout-ac 0
powercfg -change -hibernate-timeout-dc 0

turns hibernation off
powercfg -hibernate OFF

require password when console wakes up (0=false, 1=true)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0

also needed to show up on Power Menus...
powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0
powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0

power plan type (0=power saver, 1=high performance, 2=balanced)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 245d8541-3943-4422-b025-13a784f679b7 1
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c fea3413e-7e05-4911-9a71-700331f1c294 245d8541-3943-4422-b025-13a784f679b7 1

hard disk timeout
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0

wireless adapter power (0=max perf, 1=low power saving, 2=med power saving, 3=max power saving)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 19cbb8fa-5279-450e-9fac-8a3d5fedd0c1 12bbebe6-58d6-4636-95bb-3217ef867c1a 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 19cbb8fa-5279-450e-9fac-8a3d5fedd0c1 12bbebe6-58d6-4636-95bb-3217ef867c1a 0

sleep timeout
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0

close action (0=do nothing, 1=sleep, 2=hibernate, 3=shutdown)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0

also needed to show up on Power Menus...
powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0

processor power cstate (0,1=power saver, 2,3=balanced, 4,5=high perf)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 68f262a7-f621-4069-b9a5-4874169be23c 4
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 68f262a7-f621-4069-b9a5-4874169be23c 4

minimum processor state
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 893dee8e-2bef-41e0-89c6-b55d0929964c 100
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 893dee8e-2bef-41e0-89c6-b55d0929964c 100

processor power perfstate settings
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 bbdc3814-18e9-4463-8a55-d197327c45c0 4
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 54533251-82be-4824-96c1-47b60b740d00 bbdc3814-18e9-4463-8a55-d197327c45c0 4

monitor timeout
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 7516b95f-f776-4464-8c53-06167f40cc99 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e 0
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 7516b95f-f776-4464-8c53-06167f40cc99 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e 0

multimedia settings (0=take no action, 1=prevent computer from sleeping, 2=enable away mode)
powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 9596fb26-9850-41fd-ac3e-f7c3c00afd4b 03680956-93bc-4294-bba6-4e0f09bb717f 2
powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 9596fb26-9850-41fd-ac3e-f7c3c00afd4b 03680956-93bc-4294-bba6-4e0f09bb717f 2

set the absentia power scheme (the scheme used when no one is logged in)
powercfg -setabsentia 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

Enjoy... :-)

Comments

  • Anonymous
    January 01, 2003
    PingBack from http://kacper.consulting23.info/2007/11/29/powercfg-useful-if-you-know-the-guids/

  • Anonymous
    January 01, 2003
    Check out the excellent post here detailing the GUIDs involved when using the powercfg.exe command in Vista. The dirty little secret is that powercfg.exe is also pretty much the only way to control power management inside a Windows Server 2008 Core s

  • Anonymous
    October 14, 2010
    what do you mean by "also needed to show up on Power Menus..."

  • Anonymous
    May 15, 2012
    The comment has been removed

  • Anonymous
    December 19, 2012
    I still don't get it. Isn't life hard enough as it is? So what's the point in using a GUIDS instead of just a human-readable string such as "Balanced"?? I mean, it's the kind of thing I would expect not to have to research. Microsoft are the WORST at providing simple means for backing up system settings so that they can be easily restored later should the user need to re-install the OS. I was just trying to back up my power settings, and learnt that they are buried in the Registry under a key named "381b4222-f694-41f0-9685-ff5bb260df2e". For a multimillion company such as Microsoft, it's hard to believe that this is the best they can come up with.

  • Anonymous
    October 31, 2013
    The comment has been removed

  • Anonymous
    February 13, 2014
    Leaving computers on is healthier for the hardware. Turning hardware on/off all the time makes it cool/heat and expand/contract. Leave your hard to always on. And thanks Alex for the batch file, saved me 10 minutes as FOR loops in dos for some reason is always a pain.

  • Anonymous
    September 28, 2015
    Thank you Alex for that script. I'm trying to assign a power scheme through GPO and for Windows 7 it just wont make it active. So with your script I run that as part of a "InitialSetup.bat" file and it assigns the active scheme just fine by name. Really helpful.

  • Anonymous
    October 16, 2015
    isn't it easier to just use the aliases. that can be retrieved by "powercfg -aliases".
    that feels much more readable.
    then it is possible to run commands like "powercfg.exe -setactive SCHEME_MIN" "powercfg.exe -setACvalueIndex SCHEME_MIN SUB_VIDEO VIDEODIM 0"
    just take care: SCHEME_MIN is actually the max-performance scheme , i guess because it is minimal saving power haha

  • Anonymous
    November 06, 2015
    Thanks! That is just what I needed to know.