2006
07.22

Show me a sysadmin that likes to do the same thing 10 times in a row by hand and I’ll show you the sweater I got from Tony Blair. So in that vain, here is a batch file you can run from your login scripts that will automatically configure desktop and laptop power profiles in windows. Why this isn’t included in Group Policy Management I do not know, but since every copy of Windows XP sp2 has the powercfg.exe program this should be close enough to a sure thing. If you need to tweak the settings just look here for an explanation of the switches.

Desktops

@echo off
cls
:Creates a desktop power profile

:QUERY
powercfg.exe /Q cust_desktop
IF NOT ERRORLEVEL 1 GOTO QUIT
IF ERRORLEVEL 1 GOTO DELETE

:DELETE
powercfg.exe /D OLDPROFILE

:CREATE
powercfg.exe /C cust_desktop

:ADJUST
powercfg.exe /X cust_desktop /monitor-timeout-ac 0
powercfg.exe /X cust_desktop /monitor-timeout-dc 0
powercfg.exe /X cust_desktop /disk-timeout-ac 0
powercfg.exe /X cust_desktop /disk-timeout-dc 0
powercfg.exe /X cust_desktop /standby-timeout-ac 0
powercfg.exe /X cust_desktop /standby-timeout-dc 0
powercfg.exe /X cust_desktop /hibernate-timeout-ac 0
powercfg.exe /X cust_desktop /hibernate-timeout-dc 0
powercfg.exe /X cust_desktop /processor-throttle-ac NONE
powercfg.exe /X cust_desktop /processor-throttle-dc NONE

:GLOBAL
powercfg.exe /G off /OPTION BATTERYICON
powercfg.exe /G off /OPTION RESUMEPASSWORD

:ACTIVATE
powercfg.exe /S cust_desktop

:QUIT
@cls
exit

Laptops

@echo off
cls
:Creates a laptop power profile

:QUERY
powercfg.exe /Q cust_laptop
IF NOT ERRORLEVEL 1 GOTO QUIT
IF ERRORLEVEL 1 GOTO DELETE

:DELETE
powercfg.exe /D OLDPROFILE

:CREATE
powercfg.exe /C cust_laptop

:ADJUST
powercfg.exe /X cust_laptop /monitor-timeout-ac 0
powercfg.exe /X cust_laptop /monitor-timeout-dc 15
powercfg.exe /X cust_laptop /disk-timeout-ac 0
powercfg.exe /X cust_laptop /disk-timeout-dc 30
powercfg.exe /X cust_laptop /standby-timeout-ac 0
powercfg.exe /X cust_laptop /standby-timeout-dc 0
powercfg.exe /X cust_laptop /hibernate-timeout-ac 0
powercfg.exe /X cust_laptop /hibernate-timeout-dc 0
powercfg.exe /X cust_laptop /processor-throttle-ac NONE
powercfg.exe /X cust_laptop /processor-throttle-dc NONE

:GLOBAL
powercfg.exe /G on /OPTION BATTERYICON
powercfg.exe /G off /OPTION RESUMEPASSWORD

:ACTIVATE
powercfg.exe /S cust_laptop

:QUIT
@cls
exit

Switch to our mobile site