User Tools

Site Tools


wiki:windows:batch:powercfg

This is an old revision of the document!


POWERCFG

Server/HA Config

This is a batch file that should disable most of the problem settings for any machine serving up software or hardware.

@echo off
rem SET HIGH PERFORMANCE SCHEME
powercfg /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

rem Turn USB Power Saving OFF
powercfg /SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 2a737441-1930-4402-8d77-b2bebba308a3 48e6b7a6-50f5-4782-a5d4-53bb8f07e226 0

rem Turn PCIe Power Savings OFF
powercfg /SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 501a4d13-42af-4429-9fd1-a8218c268e20 ee12f906-d277-404b-b6da-e5fa1a576df5 0

rem Turn Sleep OFF
powercfg /SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 238c9fa8-0aad-41ed-83f4-97be242c8f20 29f6c1db-86da-48c5-9fdb-f2b67b1f44da 0

rem Keep Display ON
powercfg /SETACVALUEINDEX 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 7516b95f-f776-4464-8c53-06167f40cc99 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e 0

Reference

Tweaking Windows 7 Power Plans using PowerCfg command-line Options

https://www.symantec.com/connect/articles/tweaking-windows-7-power-plans-using-powercfg-command-line-options

By: ianatkin Trusted AdvisorCertified

  Created 26 Jan 2015 3 Comments 

Last week I took a look at ammending power plans in Windows 7. The aim was to create an Altiris job which ammended laptop power plans to stop them going to sleep when their lid was closed. This was for laptops which were likely to be used for presentations.

The options were,

  Create a new power plan using powercfg's import/export capability
  Ammend an existing power plan using powercfg's setvalue capability

As the desired result was just going to be one tweak, we opted for option 2 and soon regreted it.The outcome of two hours googling and general messing around was this obscure two-line command script.

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

When you look at the above, you simply have to think seriously? THREE GUIDS in order to change one setting in one plan. This struck me as amazingly awful for a tool that's intended for commandline usage.

This is how the guids break down,

  {381b4222-f694-41f0-9685-ff5bb260df2e} = GUID of "Balanced" power plan
  {4f971e89-eebd-4455-a8de-9e59040e7347} = GUID of system power control buttons subgroup
  {5ca83367-6e45-459f-a27b-476b1d01c936} = GUID of Lid Close Action power setting

So what we are seeing in the above power plan commands is this structure,

powercfg -setacvalueindex {Power Plan GUID} {Power Subgroup GUID} {Power Setting GUID} <Value> powercfg -setacvalueindex {Power Plan GUID} {Power Subgroup GUID} {Power Setting GUID} <Value>

As Microsoft have forced us to use GUIDs everywhere, you'd think that all this would be documented to the nth degree. I struggled though. I found this MSDN article from Microsoft, https://msdn.microsoft.com/en-us/library/windows/desktop/aa372769(v=vs.85).aspx, and this was useful as if revealed the structures used in the Windows API,

  DWORD WINAPI PowerWriteDCValueIndex(
     _In_opt_  HKEY RootPowerKey,
     _In_      const GUID *SchemeGuid,
     _In_opt_  const GUID *SubGroupOfPowerSettingsGuid,
     _In_opt_  const GUID *PowerSettingGuid,
     _In_      DWORD DcValueIndex
   );

Although this article includes identifiers for the power subgroups, it doesn't actually list any power settings identifiers. Finding somewhere that details enough information to provide you full access over your power plans that's been tricky. I found a post by Richard Smith from 2007 who thought it was important to know your GUIDs too. So much so, he wrote up explicitly a lot of powercfg commands for others to consume, http://blogs.technet.com/b/richardsmith/archive/2007/11/29/powercfg-useful-if-you-know-the-guids.aspx

And there was also a nice power plan write-up on Toshiba's website, https://aps2.toshiba-tro.de/kb0/HTD12017W0001R01.htm

Nothing however which detailed things in a manner than I would find useful as someone seeking information on how to tweak a specific setting. So, using the powercfg's query command (powercfg -Q) on my WIndows 7 laptop, I extracted the power setting GUIDs, simplified the output a little and then munged in the helpful explainations from the Toshiba write up. This won't be complete, but it will hopefully it contains enough to be useful to others.

Subgroup (Settings belonging to no subgroup) GUID: fea3413e-7e05-4911-9a71-700331f1c294

  Power Setting GUID: 0e796bdb-100d-47d6-a2d5-f7d2daa51f51  (Require a password on wakeup)
  Determines whether or not you must enter your Windows password when the computer wakes up from Sleep mode
  Setting 0=No
  Setting 1=Yes
   

​Subgroup (Hard disk) GUID: 0012ee47-9041-4b5d-9b77-535fba8b1442

  Power Setting GUID: 6738e2c4-e8a5-4a42-b16a-e040e769756e  (Turn off hard disk)
  Specifies how long after the most recent access before the hard disk drive turnes off. Setting a lower timeout value will save more power. Once the hard disk has turned off, there will be a slight delay with the next access, as it 'spins up' to full rotational speed. Software that runs automatically 'in the background' (search indexing, for example) may prevent the drive from turning off, by accessing it at frequent intervals
  Setting (0-4294967295) =Seconds
   

Subgroup (Desktop background settings) GUID: 0d7dbae2-4294-402a-ba8e-26777e8488cd

  Power Setting GUID: 309dce9b-bef4-4119-9921-a851fb12f0f4  (Slide show)
  Windows 7 allows users to set multiple background images that change after a user-defined interval. To reduce power consumption on battery power, the setting for slideshow should be changer from "Available" to "Paused" which reduces power drain. The difference between these two settings will be at least noticeable when the battery is low on capacity
  Setting: 0=Available
  Setting: 1=Paused

Subgroup (Wireless Adapter Settings) GUID: 19cbb8fa-5279-450e-9fac-8a3d5fedd0c1

  Power Setting GUID: 12bbebe6-58d6-4636-95bb-3217ef867c1a  (Power Saving Mode)
  There are four power saving / performance settings. If your Wi-Fi connection is unstable or slow, try selecting a higher-performance setting
  Setting 0=Maximum Performance
  Setting 1=Low Power Saving
  Setting 2=Medium Power Saving
  Setting 3=Maximum Power Saving
   

Subgroup (Sleep) GUID: 238c9fa8-0aad-41ed-83f4-97be242c8f20

  Power Setting GUID: 29f6c1db-86da-48c5-9fdb-f2b67b1f44da  (Sleep after)
  Specifies the number of minutes of inactivity (no usage of mouse or keyboard) before the computer drops into Sleep mode. A short timeout interval can save lots of power if you frequently stop using the computer, without turning it off. Sleep mode preserves the state of open programs and documents. It continues  refreshing  the computer's memory, while turning off the screen, the hard disk drive, and most of the other computer components. When the computer comes out of Sleep mode, the programs and documents re-appear, just as they were when the computer entered Sleep mode. Waking up the computer from Sleep mode is much faster than starting the computer, starting the operating system, launching programs, and opening documents. 
  Save open documents frequently to protect them from loss of battery charge during Sleep mode. Sleep mode consumes some power from the battery, but less than the normal On state. If the computer is in Sleep mode while being powered from the battery, and the battery charge runs low, the computer will turn completely Off, and will lose the open programs and documents in memory. In this case, any changes to documents that are not saved yet  disk will be lost.
  Setting (seconds) =Seconds after which sleep to occur
   
  Power Setting GUID: 94ac6d29-73ce-41a6-809f-6363ba21b47e  (Allow hybrid sleep)
  Instructs Windows to use Hybrid Sleep mode, whenever Sleep mode is activated. Hybrid Sleep mode not only saves the state of open programs and documents in the computer's memory, it also saves their state to the hard disk drive (as with Hibernation mode). Hybrid Sleep offers an additional measure of convenience. If the computer's battery becomes fully discharged while the computer is in Hybrid Sleep mode, the saved state in the computer's memory will be lost, but Windows will be able to retrieve the saved state from the hard disk drive though somewhat more slowly.
  Be sure to save your documents and other files frequently as you work on them, to create permanent copies of them on the computer's hard disk drive. Saving the state of documents with Sleep, Hybrid Sleep and Hibernation modes does not create permanent copies of them; it is just a way to save power as you pause in your work, and then quickly pick up where you left off.
  Setting 0=Off
  Setting 1=On
  Power Setting GUID: 9d7815a6-7ee4-497e-8888-515a05f02364  (Hibernate after)
  Specifies the number of minutes of inactivity (no usage of mouse or keyboard) before the computer enters Hibernation mode in which the state of open programs and documents is saved to the computer's hard disk drive. The computer is shut OFF in Hibernation mode, so that very little power is consumed. Be sure to save your documents and other files frequently as you work on them, to create permanent copies of them on the computer's hard disk drive. Saving the state of documents with Hibernation mode does not create permanent copies of them; it is just a way to save power as you pause in your work, and then quickly pick up where you left off.
  Setting (0-4294967295) =Seconds
  Power Setting GUID: bd3b718a-0680-4d9d-8ab2-e1d2b4ac806d  (Allow wake timers)
  A program or scheduled task might be waking your computer. By default, Power Option settings do not allow scheduled tasks to wake the computer from sleep or hibernate. However, some programs might awaken the computer if these settings have been changed. Set this option to "disabled" to prevent programs waking your computer.
  Setting 0=Disable
  Setting 1=Enable
   

Subgroup (USB settings) GUID: 2a737441-1930-4402-8d77-b2bebba308a3

  Power Setting GUID: 48e6b7a6-50f5-4782-a5d4-53bb8f07e226  (USB selective suspend setting)
  Prevents or allows idle USB devices and ports to be shut off to conserve power. Some computers include built-in devices that are connected internally via USB
  Setting 0=Disable
  Setting 1=Enable

Subgroup (Intel(R) Graphics Settings) GUID: 44f3beca-a7c0-460e-9df2-bb8b99e0cba6

  Power Setting GUID: 3619c3f2-afb2-4afc-b0e9-e7fef372de36  (Intel(R) Graphics Power Plan)
  The "Intel Graphics Power Plan" determines the performance level of the integrated Intel graphics device. Depending on the setting, the overall display quality will be degraded. This includes e.g. reduced color schemes, reduced hardware acceleration with 2D/3D, degraded video playback performance and no font smoothing.
  Setting 0=Maximum Battery Life
  Setting 1=Balanced
  Setting 2=Maximum Performance
   

Subgroup (Power buttons and lid) GUID: 4f971e89-eebd-4455-a8de-9e59040e7347

  Power Setting GUID: 5ca83367-6e45-459f-a27b-476b1d01c936  (Lid close action)
  Specifies the computer's response to closing the display lid: enter Sleep mode, enter Hibernation mode, shut down (turn off), or do nothing. This option provides a very convenient way to put the computer to sleep before boarding a plane or leaving the office for a meeting.
  Setting 0=Do Nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
  Power Setting GUID: 7648efa3-dd9c-4e3e-b566-50f929386280  (Power button action)
  Specifies the computer's response to pressing the power button: enter Sleep mode, enter Hibernation mode, shut down (turn off), or do nothing
  Setting 0=Do Nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
  Power Setting GUID: 96996bc0-ad50-47ec-923b-6f41874dd9eb  (Sleep button action)
  Specifies the computer's response to pressing the Sleep button: enter Sleep mode, or enter Hibernation mode. Most Toshiba computers do not have a Sleep button, but there are many other ways to place the computer in Sleep or Hibernation mode, including closing the display lid (see setting above), or selecting Sleep or Hibernation from the Windows Start Menu
  Setting 0=Do Nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
  Power Setting GUID: a7066653-8d6c-40a8-910e-a1f54b84c7e5  (Start menu power button)
  Specifies the computer's response to clicking the on/off icon on the Start Menu : enter Sleep mode, enter Hibernation mode, or shut down (turn off).
  Setting 0=Do Nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
   

Subgroup (PCI Express) GUID: 501a4d13-42af-4429-9fd1-a8218c268e20

  Power Setting GUID: ee12f906-d277-404b-b6da-e5fa1a576df5  (Link State Power Management)
  Specifies no (off), moderate, or maximum power savings for PCI Express devices, at the expense of perfomance
  Setting 0=Off
  Setting 1=Moderate power savings
  Setting 2=Maximum power savings
   

Subgroup (Processor power management) GUID: 54533251-82be-4824-96c1-47b60b740d00

  Power Setting GUID: 893dee8e-2bef-41e0-89c6-b55d0929964c  (Minimum processor state)
  Specifies the lower limit of CPU performance, as a percentage of the full potential performance of the CPU. Higher values promote higher performance (depending on CPU utilization), at the expense of greater power consumption.
  Setting (percent): 0-100 
  Power Setting GUID: 94d3a615-a899-4ac5-ae2b-e4d8f634367f  (System cooling policy)
  Active cooling means that your cooling fan will speed up and your processor will cool down while running at maximum speed. This way your system's performance is not compromised, but you will use more battery power. The passive cooling slows down the processor before speeding up the cooling fan, so your system could sometimes become cooler without even speeding up the fan and your processor will use less power, making it the best approach for when running in battery mode
  Setting 0=Passive
  Setting 1=Active
   
  Power Setting GUID: bc5038f7-23e0-4960-96da-33abaf5935ec  (Maximum processor state)
  Specifies the upper limit of CPU performance, as a percentage of the full potential performance of the CPU. Higher values promote higher performance (depending on CPU utilization), at the expense of greater power consumption. The minimum and maximum processor state values are essentially percentage of the maximum clock rate for the CPU, though other factors may be involved. For further details, see Microsoft's document Processor Power Management in Windows 7
  Setting (percent): 0-100 

Subgroup (Display) GUID: 7516b95f-f776-4464-8c53-06167f40cc99

  Power Setting GUID: 17aaa29b-8b43-4b94-aafe-35f64daaf1ee  (Dim display after)
  Specifies the number of minutes of inactivity (no usage of mouse or keyboard) before the display is dimmed. Since the display and its backlight represent a large percentage of the computer's total power consumption, selecting a relative low timeout value can allow the computer to run from its battery much longer than it would otherwise (if the computer is not being used continuously).
  Setting (0-4294967295) =Seconds
  Power Setting GUID: 3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e  (Turn off display after)
  Specifies the number of minutes of inactivity (no usage of mouse or keyboard) before the display is turned off. Since the display and its backlight represent a large percentage of the computer's total power consumption, selecting a relative low timeout value can allow the computer to run from its battery much longer than it would otherwise (if the computer is not being used continuously)
  Setting (0-4294967295) =Seconds
  Power Setting GUID: aded5e82-b909-4619-9949-f5d71dac0bcb  (Display brightness)
  Specifies the default brightness of the display when running from battery power and from AC power -- as a percentage of the maximum brightness of the display panel. On many Toshiba portable computers,  Fn+F6 and Fn+F7 key combinations may be used to decrease or increase the display brightness
  Setting (percent): 0-100 
  Power Setting GUID: f1fbfde2-a960-4165-9f88-50667911ce96  (Dimmed display brightness)
  Specifies the default brightness of the display when turning into the dimmed display mode -- as a percentage of the maximum brightness of the display panel. 
  Setting (percent): 0-100 

Subgroup (Multimedia settings) GUID: 9596fb26-9850-41fd-ac3e-f7c3c00afd4b

  Power Setting GUID: 03680956-93bc-4294-bba6-4e0f09bb717f  (When sharing media)
  Specifies whether the computer will enter either Sleep mode or Away mode when it receives a request to enter Sleep mode. There is one exception to this rule: when the request to enter Sleep mode comes from the Sleep -> Sleep After timeout (see the description above), the computer will enter Sleep mode, even if Away mode is selected in this setting. Requests for the computer to enter Hibernation mode are not affected by this setting. Away mode causes the computer to appear to be Off (or in Sleep mode) while it is still capable of processing background media tasks such as recording television content or streaming media to other devices. For more information about Away mode, see the Microsoft white paper Away Mode in Windows 7
  Setting 0=Allow the computer to sleep
  Setting 1=Prevent idling to sleep
  Setting 2=Allow the computer to enter Away Mode
  Power Setting GUID: 34c7b99f-9a6d-4b3c-8dc7-b6693b78cef4  (When playing video)
  This option sets the video quality to either degrade to provide more battery time, or high performance to view videos at full quality at the cost of a faster draining of the battery. When viewing videos, the CPU, GPU and HDD do a lot of work. The video option optimizes the computer's video playback pipeline to provide you either optimized video quality or more battery time. Video quality doesn't take that much when set to power savings, but it is somewhat noticeable depending on the video you view.
  Setting 0=Optimize video quality
  Setting 1=Balanced
  Setting 2=Optimize power savings
   

Subgroup (Internet Explorer) GUID: b14a8f96-7b67-4e78-8192-b890b1a62b8a

  Power Setting GUID: 4c793e7d-a264-42e1-87d3-7a0d2f523ccd  (JavaScript Timer Frequency)
  Internet Explorer 9 introduced a setting called 'JavaScript Timer Frequency'  which gives the option of extra power savings by slowing down JavaScript execution in the browser. To implement this Javascript throttle, simply toggle the setting from "Maximum Performance" to "Maximum Power Savings".
  Setting 0=Maximum Power Savings
  Setting 1=Maximum Performance

Subgroup (Battery) GUID: e73a048d-bf27-4f12-9731-8b2076e8891f

  Power Setting GUID: 637ea02f-bbcb-4015-8e2c-a1c7b9c0b546  (Critical battery action)
  Specifies what should happen when the battery's charge reaches a critical low level. Options include Sleep mode, Hibernate mode, and Shut down, and also Do Nothing (the default, if the computer is plugged in to AC power).
  Setting 0=Do nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
  Power Setting GUID: 8183ba9a-e910-48da-8769-14ae6dc1170a  (Low battery level)
  Specifies the percentage of battery power considered to be 'low'.
  Setting (percent): 0-100 
  Power Setting GUID: 9a66d8d7-4ff7-4ef9-b5a2-5a326ca2a469  (Critical battery level)
  Specifies the percentage of battery power considered to be 'critical'.
  Setting (percent): 0-100 
  Power Setting GUID: bcded951-187b-4d05-bccc-f7e51960c258  (Low battery notification)
  Specifies whether or not a pop-up message is displayed when the battery reaches the low battery level setting.
  Setting 0=Off
  Setting 1=On
  Power Setting GUID: d8742dcb-3e6a-4b3c-b3fe-374623cdcf06  (Low battery action)
  Specifies what should happen when the battery's charge reaches a low level. Options include Sleep mode, Hibernate mode, and Shut down, and Do Nothing (the default)
  Setting 0=Do nothing
  Setting 1=Sleep
  Setting 2=Hibernate
  Setting 3=Shutdown
  Power Setting GUID: f3c5027d-cd16-4930-aa6b-90db844a8f00  (Reserve battery level)
  "Reserve battery level" configures the percentage of battery capacity remaining before displaying the "reserve battery warning" message.
  Setting (percent): 0-100 
wiki/windows/batch/powercfg.1562700272.txt.gz · Last modified: 2019/07/09 15:24 by matt