I have a number of customers who wants to set the power settings trough the TS, as opposed to using GPO’s. I guess that makes sense if you want to allow you users to change the settings them self…
By default windows 7 will set the following power options:
- Sleep/standby in 15 min on battery (DC),
- Sleep/standby in 30 min on Power (AC).
- Hibernation after 360 min on both AC and DC.
- Sleep/standby when lid is closed on laptop.
Some of my customers do not want their machines to sleep or hibernate, unless the user makes this choice. this kind of rules out GPO, as that would prevent the users changing the settings. So to set the wanted default power options, we use POWERCFG, which is a native tool in Windows.
To see what options are available, open a command prompt with elevated privileges (Run as Administrator).
Type POWERCFG /?. to have all available parameters listed. You will see that there are quite many parameters to choose from, so to make it a little easier to work with, you can pipe the output to a TXT file like this powercfg /? > c:\PowerSyntax.TXT.
The best way though, is to check out Technet http://technet.microsoft.com/en-us/library/cc748940(WS.10).aspx
As I explained earlier, I needed to disable automatic sleep and hibernation. The first ones are quite easy, as there are standard commands for setting the timeout for both sleep and hibernation. Setting the value to Zero will disable the feature…
Disable Standby/Sleep
- powercfg -x -standby-timeout-dc 0
- powercfg -x -standby-timeout-ac 0
Disable Hibernation
- powercfg -x -hibernate-timeout-dc 0
- powercfg -x -hibernate-timeout-ac 0
The next task was to not have anything happen when the Lid of the laptops is closed! This proved a little harder, as it not just setting a timer, but rather setting a function… Looking trough the Technet article, reveals the following method of doing this!
Disable Standby/Sleep when closing the Lid
- powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
- powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0
The above syntax is actually the valueindex switch with 3 GUID’s and an index number
To find the correct GUID’s you can run the /Q switch and pipe the output to a TXT file
- Powercfg /Q > C:\PowerGUID.txt
From the TXT file you can now pick up the Needed GUID’s
- SCHEME_GUID – (notice the friendly name of the GUID in the Parentheses to the right of the GUID)
- SUB_GUID –
- SETTINGS_GUID
- SettingsIndex – (notice the friendly name of the index just beneath the index number)
You now have the info you need, so all there is to left do is run the commands as a step in your TS. Because its all command line stuff, I choose to use a bat/CMD script for that:
Running the script from a TS:
Add the command lines to a .CMD file, and place it in your scripts package. Create a “Run Command Line” Step, somewhere after the “Setup Windows and ConfigMgr” Step, and be aware that powercfg is placed in system32, so disabling 64-bit redirect on x64 systems, is necessary.
We stumbled over here by a different page and thought
I should check things out. I like what I see so i am just following you.
Look forward to looking at your web page yet again.
My weblog: יסתכלו על אתר אינטרנט זה