adsetup:group_policy_preferences:createcomputerpoweroptionspreferences
This is one of the GPP's that is likely rarely used and changed from environment to environment. While it could be setup to run through the Create_XML function, there are so many options for Power settings that it makes sense to just create a standard GPP for power and copy the XML file into the script code and updating the few options with needed variables.
The script contains a default disabled, Power Saving, Balanced and High Performance plan.
Power GPP Example
<?xml version=`"1.0`" encoding=`"utf-8`"?>
<PowerOptions clsid=`"{7B0F9381-C3B8-4525-8167-87349B671D94}`"><GlobalPowerOptionsV2 clsid=`"{2B130A62-fc14-4572-91C3-5435C6A0C3FC}`" name=`"Balanced`" image=`"2`" changed=`"$DateUni`" uid=`"$GUID`" userContext=`"0`" removePolicy=`"0`" disabled=`"1`"><Filters><FilterCollection hidden=`"1`" bool=`"AND`" not=`"0`"><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"XP`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3R2`" type=`"NE`" edition=`"NE`" sp=`"NE`"/></FilterCollection><FilterRunOnce hidden=`"1`" not=`"0`" bool=`"AND`" id=`"$GUID2`"/>
</Filters><Properties action=`"U`" nameGuid=`"{381B4222-F694-41F0-9685-FF5BB260DF2E}`" default=`"0`" requireWakePwdAC=`"YES`" requireWakePwdDC=`"YES`" turnOffHDAC=`"0`" turnOffHDDC=`"0`" sleepAfterAC=`"0`" sleepAfterDC=`"0`" allowHybridSleepAC=`"ON`" allowHybridSleepDC=`"ON`" hibernateAC=`"180`" hibernateDC=`"180`" lidCloseAC=`"SLEEP`" lidCloseDC=`"SLEEP`" pbActionAC=`"SLEEP`" pbActionDC=`"SLEEP`" strtMenuActionAC=`"HIBERNATE`" strtMenuActionDC=`"HIBERNATE`" linkPwrMgmtAC=`"MODERATE`" linkPwrMgmtDC=`"MAXIMUM`" procStateMinAC=`"5`" procStateMinDC=`"5`" procStateMaxAC=`"100`" procStateMaxDC=`"100`" displayOffAC=`"10`" displayOffDC=`"5`" adaptiveAC=`"ON`" adaptiveDC=`"ON`" critBatActionAC=`"DO_NOTHING`" critBatActionDC=`"SHUT_DOWN`" lowBatteryLvlAC=`"10`" lowBatteryLvlDC=`"10`" critBatteryLvlAC=`"5`" critBatteryLvlDC=`"5`" lowBatteryNotAC=`"OFF`" lowBatteryNotDC=`"OFF`" lowBatteryActionAC=`"DO_NOTHING`" lowBatteryActionDC=`"DO_NOTHING`"/></GlobalPowerOptionsV2>
<GlobalPowerOptionsV2 clsid=`"{2B130A62-fc14-4572-91C3-5435C6A0C3FC}`" name=`"High Performance`" image=`"2`" changed=`"$DateUni`" uid=`"$GUID`" userContext=`"0`" removePolicy=`"0`" disabled=`"1`"><Filters><FilterCollection hidden=`"1`" bool=`"AND`" not=`"0`"><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"XP`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3R2`" type=`"NE`" edition=`"NE`" sp=`"NE`"/></FilterCollection><FilterRunOnce hidden=`"1`" not=`"0`" bool=`"AND`" id=`"$GUID2`"/>
</Filters><Properties action=`"U`" nameGuid=`"{8C5E7FDA-E8BF-4A96-9A85-A6E23A8C635C}`" default=`"0`" requireWakePwdAC=`"YES`" requireWakePwdDC=`"YES`" turnOffHDAC=`"0`" turnOffHDDC=`"0`" sleepAfterAC=`"0`" sleepAfterDC=`"0`" allowHybridSleepAC=`"ON`" allowHybridSleepDC=`"ON`" hibernateAC=`"0`" hibernateDC=`"0`" lidCloseAC=`"SLEEP`" lidCloseDC=`"SLEEP`" pbActionAC=`"SLEEP`" pbActionDC=`"SLEEP`" strtMenuActionAC=`"HIBERNATE`" strtMenuActionDC=`"HIBERNATE`" linkPwrMgmtAC=`"OFF`" linkPwrMgmtDC=`"OFF`" procStateMinAC=`"100`" procStateMinDC=`"5`" procStateMaxAC=`"100`" procStateMaxDC=`"100`" displayOffAC=`"15`" displayOffDC=`"10`" adaptiveAC=`"ON`" adaptiveDC=`"ON`" critBatActionAC=`"DO_NOTHING`" critBatActionDC=`"SHUT_DOWN`" lowBatteryLvlAC=`"10`" lowBatteryLvlDC=`"10`" critBatteryLvlAC=`"5`" critBatteryLvlDC=`"5`" lowBatteryNotAC=`"OFF`" lowBatteryNotDC=`"OFF`" lowBatteryActionAC=`"DO_NOTHING`" lowBatteryActionDC=`"DO_NOTHING`"/></GlobalPowerOptionsV2>
<GlobalPowerOptionsV2 clsid=`"{2B130A62-fc14-4572-91C3-5435C6A0C3FC}`" name=`"Power Saver`" image=`"2`" changed=`"$DateUni`" uid=`"$GUID`" userContext=`"0`" removePolicy=`"0`" disabled=`"1`"><Filters><FilterCollection hidden=`"1`" bool=`"AND`" not=`"0`"><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"XP`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3`" type=`"NE`" edition=`"NE`" sp=`"NE`"/><FilterOs hidden=`"1`" not=`"1`" bool=`"AND`" class=`"NT`" version=`"2K3R2`" type=`"NE`" edition=`"NE`" sp=`"NE`"/></FilterCollection><FilterRunOnce hidden=`"1`" not=`"0`" bool=`"AND`" id=`"$GUID2`"/>
</Filters><Properties action=`"U`" nameGuid=`"{A1841308-3541-4FAB-BC81-F71556F20B4A}`" default=`"0`" requireWakePwdAC=`"YES`" requireWakePwdDC=`"YES`" turnOffHDAC=`"20`" turnOffHDDC=`"5`" sleepAfterAC=`"0`" sleepAfterDC=`"0`" allowHybridSleepAC=`"ON`" allowHybridSleepDC=`"ON`" hibernateAC=`"180`" hibernateDC=`"180`" lidCloseAC=`"SLEEP`" lidCloseDC=`"SLEEP`" pbActionAC=`"SLEEP`" pbActionDC=`"SLEEP`" strtMenuActionAC=`"HIBERNATE`" strtMenuActionDC=`"HIBERNATE`" linkPwrMgmtAC=`"MAXIMUM`" linkPwrMgmtDC=`"MAXIMUM`" procStateMinAC=`"5`" procStateMinDC=`"5`" procStateMaxAC=`"100`" procStateMaxDC=`"100`" displayOffAC=`"5`" displayOffDC=`"2`" adaptiveAC=`"ON`" adaptiveDC=`"ON`" critBatActionAC=`"DO_NOTHING`" critBatActionDC=`"SHUT_DOWN`" lowBatteryLvlAC=`"10`" lowBatteryLvlDC=`"10`" critBatteryLvlAC=`"5`" critBatteryLvlDC=`"5`" lowBatteryNotAC=`"OFF`" lowBatteryNotDC=`"OFF`" lowBatteryActionAC=`"DO_NOTHING`" lowBatteryActionDC=`"DO_NOTHING`"/></GlobalPowerOptionsV2>
</PowerOptions>
Power Attribute nameGuid is what identifies the type of plan.
High Performance - {8C5E7FDA-E8BF-4A96-9A85-A6E23A8C635C}
Balanced - {381B4222-F694-41F0-9685-FF5BB260DF2E}
Power saver - {A1841308-3541-4FAB-BC81-F71556F20B4A}
Steps to create the XML file code for the script:
- Create a new GPO and identify the GUID and location on the SYSVOL.
- Edit the GPO and browse to Computer Configuration → Preferences → Control Panel Settings → Power Options
- Create desired Power Plans
- Browse to network location of GPO
- Open in in a text editor, such as Notepad, and edit the following:
- Find changed and replace the date and time with:
$DateUni - Find uid and replace the GUID with:
$GUID - Find and replace all quotes “ with backtick quote `”
- Update any other options, such as description or targeting
- If the the Apply once and do not reapply has been selected find id and replace with
$GUID2
- Select all text and copy to clipboard
- Paste into
Function CreateComputerPowerOptionsPreferencesbetween the quotes on the Add-Content $ECPowerOptionsXMLFile line.
- Save and run script to confirm functionality
adsetup/group_policy_preferences/createcomputerpoweroptionspreferences.txt · Last modified: 2017/04/01 03:04 by 127.0.0.1
