Power Scheme Profile force for XP, Vista and 7 (powercfg.exe)

One of the issues we’ve faced as an MSP is when computers turn off, hibernate or go into standby at night during regularly scheduled maintenance.

I’ve created the following Kaseya script to prevent this from happening. This script can be run on Windows XP, Windows Vista, and Windows 7 platforms. I have no tested it on Windows 2000, or any server platform. (BTW, this is PRE K2!)



Script Name: Power Schemes XP, Vista, 7
Script Description:


IF True
THEN
Execute Shell Command
Parameter 1 : powercfg.exe -DUPLICATESCHEME 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -CHANGENAME 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa “NEWSCHEME”
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -monitor-timeout-ac 20
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -monitor-timeout-dc 10
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -disk-timeout-ac 0
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -disk-timeout-dc 0
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -standby-timeout-ac 0
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -standby-timeout-dc 20
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -hibernate-timeout-ac 0
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : powercfg.exe -x -hibernate-timeout-dc 0
Parameter 2 : 0
OS Type : 10
Execute Shell Command
Parameter 1 : Powercfg.exe /create NEWSCHEME
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /setactive NEWSCHEME
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -monitor-timeout-ac 20
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -monitor-timeout-dc 10
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -disk-timeout-ac 0
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -disk-timeout-dc 0
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -standby-timeout-ac 0
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /x NEWSCHEME -standby-timeout-dc 20
Parameter 2 : 0
OS Type : 8
Execute Shell Command
Parameter 1 : powercfg.exe /hibernate off
Parameter 2 : 0
OS Type : 8
ELSE


For those of you who do not have Kaseya and would like batch files, You’ll have to keep the XP and the Vista/7 scripts seperate… Here they are.



REM Windows XP
Powercfg.exe /create NEWSCHEME
powercfg.exe /setactive NEWSCHEME


powercfg.exe /x NEWSCHEME -monitor-timeout-ac 20
powercfg.exe /x NEWSCHEME -monitor-timeout-dc 10
powercfg.exe /x NEWSCHEME -disk-timeout-ac 0
powercfg.exe /x NEWSCHEME -disk-timeout-dc 0
powercfg.exe /x NEWSCHEME -standby-timeout-ac 0
powercfg.exe /x NEWSCHEME -standby-timeout-dc 20
powercfg.exe /hibernate off


And Vista / 7



powercfg.exe -DUPLICATESCHEME 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa


REM rename new Highperformance to ParallelEdge


powercfg.exe -CHANGENAME 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa “NEWSCHEME”


powercfg.exe -SETACTIVE 8c5e7fda-e8bf-4a96-9a85-a6e23a8caaaa


powercfg.exe -x -monitor-timeout-ac 20
powercfg.exe -x -monitor-timeout-dc 10
powercfg.exe -x -disk-timeout-ac 0
powercfg.exe -x -disk-timeout-dc 0
powercfg.exe -x -standby-timeout-ac 0
powercfg.exe -x -standby-timeout-dc 20
powercfg.exe -x -hibernate-timeout-ac 0
powercfg.exe -x -hibernate-timeout-dc 0


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s