Script to change Power Management setting in ConfigMgr 2012 client

There was a request a couple of days ago for a script to change the Power Management setting in Software Center so that the “Do not apply power settings from my IT department to this computer” is selected by default instead of letting the power settings automatically apply to the computer.

Powersettings2

I wrote a script a while back on how to change the setting for “Automatically install or uninstall required software and restart the computer only outside of the specified business hours”. http://social.technet.microsoft.com/Forums/en-US/configmanagerapps/thread/08d2f8e9-feaf-4143-af56-7e97ef20267c/

Torsten Meringer, ECM MVP wrote a blog post and a script a while back on how to modify the Business Hours using a vbscript, it can be found here: http://www.mssccmfaq.de/2012/03/26/software-center-business-hours-auslesen-setzen/

This is basically based on the same script as the two above, it was very easy to modify it to change the setting above, here it is:

Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_PowerManagementSettings")

Set inParam = objUX.Methods_.Item("SetPowerManagementSettings").inParameters.SpawnInstance_()
inParam.IsOptOutFromPowerPlan = "True"
Set result = objUX.ExecMethod_("SetPowerManagementSettings", inParam)

Set objUX = GetObject("winmgmts:\\.\root\ccm\ClientSDK:CCM_PowerManagementSettings")

Set inParam = objUX.Methods_.Item("SetPowerManagementSettings").inParameters.SpawnInstance_()

inParam.IsOptOutFromPowerPlan = "True"

Set result = objUX.ExecMethod_("SetPowerManagementSettings", inParam)

Note that to be allowed to change the setting you need to edit the client settings which is applied to the client as well.

Powersettings1

Another note, if you are testing this Power Settings in ConfigMgr 2012 does not apply to virtual clients, you will get an “access denied error” if you try run it.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *