Windows 7 Power Scheme Configuration using POWERCFG.EXE
If you are responsible for supporting or managing laptops, you most likely have found the need to properly configure power settings or the “power scheme“. Or if not, perhaps this is a task you should look into. You could use the GUI in Control Panel, or you could take advantage of a command line tool in Windows 7 called POWERCFG.EXE and maximize your efficiency. Let’s look at a few features of this handy utility.
First, open a command prompt (or PowerShell if you prefer) and run this command:
C:\> powercfg /?
Figure 1 Powercfg help
As you can see there are many ways to use this tool. You can use either the long parameter names or the short. If you are going to be scripting anything with this utility, I suggest using the long parameter names. It won’t impact the command but will make your script easier to read.
Say Goodbye to Traditional PC Lifecycle Management
Traditional IT tools, including Microsoft SCCM, Ghost Solution Suite, and KACE, often require considerable custom configurations by T3 technicians (an expensive and often elusive IT resource) to enable management of a hybrid onsite + remote workforce. In many cases, even with the best resources, organizations are finding that these on-premise tools simply cannot support remote endpoints consistently and reliably due to infrastructure limitations.
List Power Schemes
First, let’s see what schemes are currently available.
Figure 2 Existing Power Schemes
The setting marked with an asterisk is the current setting. Depending on your laptop vendor and installed applications you will most likely have a different list. Or if you simply wanted to see the active scheme, use this command:
But what is in these schemes? We can use the –Query parameter. By default it shows all scheme details.
Otherwise, you will need to copy and paste a GUID.
C:\>powercfg -query 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c | more
Because there is so much information, you might want to pipe to the MORE command to get details in paged form.
Setting Power Schemes
Let’s suppose that I want to change the power scheme to Balanced. To accomplish this I need to know the scheme’s GUID, which I can get with the -List parameter. Fortunately, the Microsoft created power schemes use GUIIDs that are the same across computers. Thus I can run this same command across all my laptops.
C:\>powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e
Or more likely I’d create a simple batch file.
If you want to create your own scheme, or even modify an existing one, I’d recommend first creating a duplicate scheme, which will generate a new GUID.
C:\>powercfg -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e
Figure 4 Duplicating a Power Scheme
But now I have two schemes with the same name.
C:\>powercfg -changename c95a7e6d-87d1-4da1-98cf-f57aa87046dc MyPower "balanced but tweaked"
Now I’ve renamed it to “MyPower” and added an optional description. There are a number of things I might want to change, but for the sake of this article I’ll configure the Power button to shutdown when on AC. This is going to require knowing some GUIDS and hex values for the different settings so I’ll save the settings to a text file so I can copy and paste.
C:\>powercfg -query c95a7e6d-87d1-4da1-98cf-f57aa87046dc > MyPower.txt
This is the relevant section.
Power Setting GUID: 7648efa3-dd9c-4e3e-b566-50f929386280 (Power button action) Possible Setting Index: 000 Possible Setting Friendly Name: Do nothing Possible Setting Index: 001 Possible Setting Friendly Name: Sleep Possible Setting Index: 002 Possible Setting Friendly Name: Hibernate Possible Setting Index: 003 Possible Setting Friendly Name: Shut down Current AC Power Setting Index: 0x00000001 Current DC Power Setting Index: 0x00000001
Currently it is set to Sleep. Here’s the command to change it.
C:\>powercfg -setacvalueindex c95a7e6d-87d1-4da1-98cf-f57aa87046dc 4f971e89-eebd-4455-a8de-9e59040e7347 7648efa3-dd9c-4e3e-b566-50f929386280 3
Now you see why copying and pasting is necessary. The first GUID is for the scheme, the second is for the sub group and the third is for the setting. The last number is the index number from the list of possible settings.
Import and Export PowerSchemes
If I want to reuse this on another computer I can export it.
C:\>powercfg -export r:\mypower.cfg c95a7e6d-87d1-4da1-98cf-f57aa87046dc
The exported file is not anything you can edit. Now I can go to my other laptop and import it.
C:\>powercfg –import r:\mypower.cfg
Unfortunately, this is where it gets tricky, especially if you are trying to automate and of this. When you import, the scheme gets a new GUID. So to assign this as the new default I have to manually intervene or use a few scripting techniques to discover and re-use the GUID. But it is not impossible.
As you’ve seen, Powercfg.exe requires a fair amount of typing and almost all commands require you to specify the GUID. Yet I hope this doesn’t deter you from taking advantage of this valuable utility.