The powercfg command can help you with this.  You can also use Group Policy 
Preferences to help with this.

Here is a snippet from a script I created a few years ago to help adjust this 
(after looking at this script again, there is a lot of room for improvement, 
but it should get the job done for now):

$PowerSchemeGUIDBalanced          = @('Balanced', 
'381b4222-f694-41f0-9685-ff5bb260df2e')
$PowerSchemeGUIDHighPerformanced   = @('High Performance', 
'8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c')
$PowerSchemeGUIDPowerSaver        = @('Power Saver', 
'a1841308-3541-4fab-bc81-f71556f20b4a')
$PowerSchemeGUIDPowerButtonsAndLid = '4f971e89-eebd-4455-a8de-9e59040e7347'     
 # this is the Subgroup GUID for "Power Buttons and Lid" retrieved from 
powercfg -q
$PowerSchemeGUIDPowerButtonAction  = '7648efa3-dd9c-4e3e-b566-50f929386280'     
 # this is the Setting GUID for "Power Button Action" retrieved from powercfg -q
$PowerSchemePowerButtonShutDown    = '3'                                        
           # this is the Setting index for "Shut Down" in "Power Button Action" 
retrieved from powercfg -q
$arrAllPowerSchemeGUIDs                 = @($PowerSchemeGUIDBalanced, 
$PowerSchemeGUIDHighPerformanced, $PowerSchemeGUIDPowerSaver)

# This iterates through each built in power plan and makes changes to the 
settings
foreach ($arrPowerSchemeGUID in $arrAllPowerSchemeGUIDs) {
     # Sets the Power Button action to shut down the computer
     # 
http://social.technet.microsoft.com/Forums/en/itprovistadesktopui/thread/b326a098-f6eb-4121-a2bb-69035c7af85f
     Write-Host "Set the Power Button action to shut down the computer"
     powercfg -setdcvalueindex $arrPowerSchemeGUID[1] 
$PowerSchemeGUIDPowerButtonsAndLid $PowerSchemeGUIDPowerButtonAction 
$PowerSchemePowerButtonShutDown
     powercfg -setacvalueindex $arrPowerSchemeGUID[1] 
$PowerSchemeGUIDPowerButtonsAndLid $PowerSchemeGUIDPowerButtonAction 
$PowerSchemePowerButtonShutDown
}

-Aakash Shah

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Bhasker Chittanoori
Sent: Monday, April 6, 2015 3:38 PM
To: MSSMS SMS
Subject: [scripting] Powermanagement for win7

does any one know how do i change the options for "choose what closing the lid" 
in win 7 using regkeys or script. I wanted to push this to the whole audiences 
in our corporate level along with image deployment process.
The current setting they have is all "sleep"

I searched in forums and couldnt get the correct path...
looking for
1. Lid Close actions
2. Power button action





________________________________
Bhasker, Chittanoori


Reply via email to