Author: Paul Fox, Senior Consultant

Scenario: A customer wants a custom power plan for their laptop images. This is a frequent request to meet new Green initiatives in Federal and State governments.

Here are the steps to incorporate a scripted power configuration. The resulting install.cmd can be embedded into a task sequence of Microsoft Deployment Toolkit.

Note: Powercfg.exe is included in Vista, Windows XP SP2 and Windows Server 2003 operating systems.

1. Configure a power plan through the Control Panel -> Power Options UI

clip_image002[4]

2. Determine the GUID of your new power plan

C:\>Powercfg –l

Existing Power Schemes (* Active)

-----------------------------------

Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *

Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)

Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)

3. Export the power plan

C:\ >powercfg -export <plan>.pow <guid_power_plan>

3. Import the <plan.pow> as an Application into MDT server

4. Create an Install.cmd batch file in notepad and call it as a command line parameter when importing into MDT’s Applications, contents as follows:

Note: In this script powercfg.exe will generate the GUID for the imported power plan. You can also assign a GUID to the power plan by passing it with the import command.

powercfg -import filename [GUID]

filename

Specifies a fully qualified path to a file generated by using the powercfg -export option.

GUID

(optional) Represents the settings loaded into a power scheme. If not supplied, Powercfg will generate and use a new GUID

Modify the import and set active portions with:

Set MYGUID=A6319DFD-EEF4-4644-9D74-9724744F1971

Powercfg.exe –import C:\scheme.pow %MYGUID%

Powercfg.exe –setactive %MYGUID%

If you generate your own GUID it is recommended to us a GUID generating utility (e.g. GUIDGEN included in developer tools)

:: Run Power Management Policy

:: Copy files locally, execute then delete

echo

C:

cd \users\public\downloads

mkdir powermgmt

cd powermgmt

copy "\\<MDT_Server>\distribution$\Applications\Laptop Power Management\*.*" \users\public\downloads\powermgmt

:: Import power plan

c:\windows\system32\powercfg -import C:\users\public\downloads\powermgmt\<plan>.pow

:: Get the GUID of the power plan

c:\windows\system32\powercfg -l > plans.txt

findstr /C "<plan_displayname>" plans.txt > import_plan.txt

:: Set power plan to active

for /F "tokens=4 delims= " %%i in (import_plan.txt) do c:\windows\system32\powercfg -setactive %%i

:: Delete

cd ..

rd /Q /S powermgmt

5. Open Control Panel -> Power Options UI and you will see you custom plan as “active.”

clip_image004[4]

More information about Powercfg.exe can be found at http://technet2.microsoft.com/WindowsVista/en/library/1d58b934-f56a-4796-b2df-7be2eb9c03bc1033.mspx?mfr=true