I want to set the Power button action to Turn off the display on multiple computers using a Group Policy. The value is available locally via Control Panel, Power Options but not via the Group Policy Management console.

Microsoft documentation, such as the following article, confirms these are the only group policy options.

Conserving Energy with Group Policy | Microsoft TechNet

Select the Power Button Action (Plugged In):

Specifies the action that Windows takes when a user presses the power button. Possible actions include Take no action, Sleep, Hibernate, and Shut Down.

Question: Using a GPO (GPO setting, registry value, or script), how can I set the Power button action to Turn off the display?

  • 1
    You cannot do this with GPO. The best option would just to set a GPO to turn off the screens. – Zapto Jul 6 at 20:38
up vote 2 down vote accepted
+50

TL;DR: GPO Script

powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS PBUTTONACTION 4


Looks like the documentation and GPO just hasn't been updated. There is a value for it at least in powercfg it's just not documented.

Powercfg usage:

powercfg /setacvalueindex {scheme_GUID} {sub_GUID} {setting_GUID} {setting_index}

And you can set the scheme_GUID to SCHEME_CURRENT so you don't have to query it in your script

powercfg /setacvalueindex SCHEME_CURRENT {sub_GUID} {setting_GUID} {setting_index}

There are a list of the GUIDs for options here:

Power Settings

And here are the powercfg usage docs:

Powercfg options


The sub_GUID for power settings is:

SUB_BUTTONS

4f971e89-eebd-4455-a8de-9e59040e7347

And the setting_GUID for the power button is:

PBUTTONACTION

7648efa3-dd9c-4e3e-b566-50f929386280

Setting Index/Values:

0 - Do Nothing

1 - Sleep

2 - Hibernate

3 - Shut Down

4 - Turn off Display - Not documented but tested on my machine, works fine


So you would end up with one of the two below:

powercfg /setacvalueindex SCHEME_CURRENT 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 4

OR

powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS PBUTTONACTION 4

And if you want to change it on all plans, you can list all the plans with powercfg /list, recurse through them replacing {scheme_GUID} with the power scheme

  • I had to run each call as cmd /k powercfg <options> for some reason. This got the job done. Bounty awarded. – Steven Jul 13 at 18:20

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.