none
Powercfg (System Cooling Policy) RRS feed

  • Question

  • I'd like to create a PowerShell script that will only create the setting for Power Cooling Policy where the Battery needs to be set to Passive and Plugged in to Active and only work on a laptop the script will also run on a desktop but I don't want it run on a Desktop I want the desktop to keep its settings.

    this command hasn't been working:

    Powercfg -setdcvalueindex 54533251-82be-4824-96c1-47b60b740d00 94D3A615-A899-4AC5-AE2B-E4D8F634367F 381b4222-f694-41f0-9685-ff5bb260df2e

    • Moved by Bill_Stewart Thursday, June 18, 2015 6:22 PM Question outside forum scope/abandoned
    Wednesday, March 18, 2015 8:28 PM

All replies

  • try to punch the regkey, that is what we do:

    How to use the registry to set the preferred power plan



    Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
    322756
          (https://support.microsoft.com/kb/322756/            )    
    How to back up and restore the registry in Windows


    To change the preferred power plan, follow these steps:
    1. Click Start
      Collapse this imageExpand this image
       Start button
      , type regedit in the Start Search box, and then click regedit.exe in the Programs list.
      Collapse this imageExpand this image
       User Account Control permission
      If you are prompted for an administrator password or for confirmation, type your password, or click Continue.
    2. Locate and then click the following registry subkey:
      HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\ControlPanel\NameSpace\{025A5937-A6BE-4686-A844-36FE4BEC8B6D}
    3. Right-click PreferredPlan, and then click Modify.
    4. In the Value data box, enter one of the following:
      • Type 381b4222-f694-41f0-9685-ff5bb260df2e to use the Balanced plan.
      • Type a1841308-3541-4fab-bc81-f71556f20b4a to use the Power saver plan.
      • Type 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c to use the High performance plan.
      You can also type the power scheme GUID for a custom power plan that you have created. To determine the GUID for all existing power schemes, type Powercfg /List at the command prompt, and then press ENTER.  
    5. Click OK, and then exit Registry Editor.
    Note The specified power scheme in the PreferredPlan registry value cannot be explicitly shown in any UI. Regardless of this registry setting, the "(Recommended)" suffix is always added to the Balanced plan on the Power Options page.

    Wednesday, March 18, 2015 8:41 PM
  • You will have to write your script to check the hardware type. There are spots in the registry and WMI that you can query to get hardware and model information.

    with powershell you can use:

     
    gwmi win32_systemenclosure | select *

    chassistype is defined in a table here:

    https://msdn.microsoft.com/en-us/library/aa394474(v=vs.85).aspx

    Wednesday, March 18, 2015 8:48 PM
  • PowerCfg can do all without the registry.

    POWERCFG -SETACTIVE <SCHEME_GUID>

    Use WMI to get the chassis type.

    if((gwmi win32_systemenclosure).ChassisTypes[0] -eq 6){
         # laptop
    }else{
      # not laptop
    }


    ¯\_(ツ)_/¯

    • Proposed as answer by jrv Wednesday, March 18, 2015 9:06 PM
    Wednesday, March 18, 2015 9:06 PM
  • I'd rather have it in a script because I its going to be in a custom action in the Installer.
    Wednesday, March 18, 2015 9:31 PM
  • the person that wants me to get this done said to use the regkey to determine if its a laptop.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\ACPI0003\2&daba3ff&1

    Wednesday, March 18, 2015 9:33 PM
  • I'd rather have it in a script because I its going to be in a custom action in the Installer.

    PowerCfg run perfectly well in a PowerShell script.  There is no PowerShell CmdLet to set the setting and the registry hack is inconsistent across platforms and does not take effect immediately.

    MDT can do this in a settings section without a script.


    ¯\_(ツ)_/¯

    Wednesday, March 18, 2015 9:34 PM
  • the person that wants me to get this done said to use the regkey to determine if its a laptop.

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\ACPI\ACPI0003\2&daba3ff&1


    That's too bad. 

    ¯\_(ツ)_/¯

    Wednesday, March 18, 2015 9:35 PM
  • This is Awesome!!!!!!!!! but I don't Understand this part: POWERCFG -SETACTIVE <SCHEME_GUID> will that set it when Battery: Active and Plugged in: Passive?

    POWERCFG -SETDCTIVE 54533251-82be-4824-96c1-47b60b740d00 893dee8e-2bef-41e0-89c6-b55d0929964c 94D3A615-A899-4AC5-AE2B-E4D8F634367F 0

    if((gwmi win32_systemenclosure).ChassisTypes[0] -eq 6){
         # laptop
    }else{
      # not laptop
    }

    You rock thank you.

    Wednesday, March 18, 2015 9:38 PM
  • he doesn't know power shell so what you did was better.
    Wednesday, March 18, 2015 9:44 PM
  • Good you are welcome.

    The guid is the policy selected.  The policy is whatever it is set to do when on battery.  You cannot control that part with any tool.  YOu can edit the policy with POWERCFG and you can make any policy current.  Whether it I son battery or not is up to the hardware.

    If someone is asking you to put it on battery or something like that they are just pulling your chain.  YOu can only edit and set the policy.  The mode of the policy is chosen by Windows and the ACPI standard. It is an industry and hardware standard for computers.

    http://en.wikipedia.org/wiki/Power_management


    ¯\_(ツ)_/¯

    Wednesday, March 18, 2015 9:55 PM
  • That's good info but I did have it working with Install shield script but when I ran it on a desktop it set it to passive. I'm not an Install shield script expert but I looked at the existing script and put this in.

    fdbk_RunCmd( "powercfg", "/setdcvalueindex "+GUID+" "           + //Power Scheme GUID
                "54533251-82be-4824-96c1-47b60b740d00 "+ //Subgroup (Processor power mgmnt)
                "94D3A615-A899-4AC5-AE2B-E4D8F634367F "+ //Setting (System cooling policy)
                "1", WAIT, listResponse );               //Passive  

    fdbk_RunCmd( "powercfg", "/setacvalueindex "+GUID+" "      + //Power Scheme GUID "54533251-82be-4824-96c1-47b60b740d00 "+ //Subgroup (Processor power mgmnt)              "94D3A615-A899-4AC5-AE2B-E4D8F634367F "+ //Setting (System cooling policy)

    "0", WAIT, listResponse );                                 //Active 

      This set the laptop   Plugged in to Passive and Set the On Battery to Active.

    But when I ran it on the desktop it set the desktop to Passive I wanted to leave the Desktop defaulting to Active. which your script will do.

    I thought that in the Powercfg command /Setacvalueindex do you see the AC in the command swtich I thought that meant AC meaning Plugged in. and in the Other one up "/setdcvalueindex the DC meant on battery so it set it to Passive.

    I'm going to use what you gave me an do some tests on it tomorrow. I like PowerShell it works with way less code.

    • Edited by CarlRTX64 Thursday, March 19, 2015 12:05 AM editing
    Wednesday, March 18, 2015 11:48 PM
  • MDT has nothing to do with "InstallShield" and you are likely not going to be able to change the configuration with an installer.

    ¯\_(ツ)_/¯

    Wednesday, March 18, 2015 11:56 PM