Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Changing power options with login script

Posted on 2010-09-08
6
Medium Priority
?
1,122 Views
1 Endorsement
Last Modified: 2012-05-10
Hello,
I need a logon script to set the following power options settings on laptops.

when i close the LID of my portable computer ( Do nothing)

When plugged in

1.  turn off monitor   ( Never )
2. turn off hard disk ( Never )
3. System Standby (Never )

When running on battery

1. turn off monitor  ( after 15 minutes)
2. turn off hard disk ( after 30 minutes)
3. system standby ( after 25 minutes)

Thanks
1
Comment
Question by:Yucel Altingoz
  • 4
6 Comments
 
LVL 14

Expert Comment

by:Dhiraj Mutha
ID: 33628306
You can do the same using a Batch file with powercfg command which is a build in function in Windows.
These the commands - You can just type powercfg /? in command prompt and check.
 

POWERCFG [/LIST | /QUERY [name] | /CREATE name | /DELETE name |
       /SETACTIVE name | /CHANGE name settings |
       /HIBERNATE {ON|OFF} | /EXPORT name [/FILE filename] |
       /IMPORT name [/FILE filename] | /GLOBALPOWERFLAG {ON|OFF} /OPTION flag |
       /BATTERYALARM {LOW|CRITICAL} [settings] |
       /DEVICEQUERY queryflags | /DEVICEENABLEWAKE devicename |
       /DEVICEDISABLEWAKE devicename | /?]
Description:
    This command line tool enables an administrator to control
    the power settings on a system.
Parameter List:
    /LIST, /L       Lists the names of existing power schemes.
    /QUERY, /Q      Displays the configuration of the specified power scheme.
                    If no name is specified, the configuration of the currently
                    active power scheme is displayed.
    /CREATE, /C     Creates a power scheme with the specified name.  The new
                    scheme is created with the properties of the currently
                    active scheme.
    /DELETE, /D     Deletes the power scheme with the specified name.
    /SETACTIVE, /S  Makes the power scheme with the specified name active.
    /CHANGE, /X     Changes settings of the specified power scheme. Additional
                    switches specify the changes as follows:
                        /monitor-timeout-ac <minutes>
                        /monitor-timeout-dc <minutes>
                        /disk-timeout-ac <minutes>
                        /disk-timeout-dc <minutes>
                        /standby-timeout-ac <minutes>
                        /standby-timeout-dc <minutes>
                        /hibernate-timeout-ac <minutes>
                        /hibernate-timeout-dc <minutes>
                        /processor-throttle-ac <throttle>
                        /processor-throttle-dc <throttle>
                    AC settings are used when the system is on AC power.
                    DC settings are used when the system is on battery power.
                    Setting a timeout to zero will disable the corresponding
                    timeout feature.  Supported throttle settings are NONE
                    CONSTANT, DEGRADE, and ADAPTIVE.
    /EXPORT, /E     Exports the power scheme with the specified name to a
                    file.  If no filename is specified, the default is
                    SCHEME.POW.  This additional parameter is supported:
                        /FILE <filename>
    /IMPORT, /I     Imports the power scheme from a file under the specified
                    name.  If no filename is specified, the default is
                    SCHEME.POW.  If a scheme with that name already exists, it
                    is replaced with the new one.  This additional parameter
                    is supported:
                        /FILE <filename>
    /HIBERNATE, /H {ON|OFF}  Enables/Disables the hibernate feature.  Hibernate
                    timeout is not supported on all systems.
    /NUMERICAL, /N  Allows the power scheme to be operated upon to be specified
                    using a numerical identifier.  When using this switch, in
                    place of the name of the power scheme on the command line,
                    specify its numerical identifier.  This switch may be used
                    in combination with the /QUERY, /DELETE, /SETACTIVE,
                    /CHANGE, /EXPORT, and /IMPORT commands.
    /GLOBALPOWERFLAG, /G {ON|OFF}  Turns one of the global power flags on/off.
                    Valid flags (to be used after "/OPTION ") are:
                         BATTERYICON:    Turns the battery meter icon in the
                                         system tray on/off.
                         MULTIBATTERY:   Turns on/off multiple battery display
                                         in system Power Meter.
                         RESUMEPASSWORD: Prompt for password on resuming the
                                         system.
                         WAKEONRING:     Turn on/off wake on ring support.
                         VIDEODIM:       Turn on/off support for dimming video
                                         display on battery power.
    /AVAILABLESLEEPSTATES, /A  Reports the sleep states available on the
                    system.  Attempts to report reasons why sleep states are
                    unavailable.
    /BATTERYALARM, /B {LOW|CRITICAL}  Configures the battery alarm.  The
                    following switches can be specified:
                        /activate <on|off>
                            Enables or disables the alarm.
                        /level <percentage (0 - 100)>
                            The alarm will be activated when the power level
                            reaches this percentage.
                        /text <on|off>
                            Turns the text notification on or off.
                        /sound <on|off>
                            Turns the audible notification on or off.
                        /action <none|shutdown|hibernate|standby>
                            Specifies the action to take when this alarm goes
                            off.  Not all actions are always available.
                        /forceaction <on|off>
                            Force stand by or shutdown even if a program stops
                            responding.
                        /program <on|off>
                            Specifies a program to run.  schtasks.exe /change
                           may be used to configure the program.
    /DEVICEQUERY <queryflags> will return a list of devices that meet the
                    criteria specified in <queryflags>.  Possible values
                    for <queryflags> are:
                    wake_from_S1_supported - return all devices that support
                             waking the system from a light sleep state.
                    wake_from_S2_supported - return all devices that support
                             waking the system from a deeper sleep state.
                    wake_from_S3_supported - return all devices that support
                             waking from the deepest sleep state.
                    wake_from_any - return all devices that support waking
                             from any sleep state.
                    S1_supported - list devices supporting light sleep states.
                    S2_supported - list devices supporting deeper sleep.
                    S3_supported - list devices supporting deepest sleep.
                    S4_supported - list devices supporting system hibernation.
                    wake_programmable - list devices that are user-configurable
                             to wake the system from a sleep state.
                    wake_armed - list devices that are currently configured to
                             wake the system from any sleep state.
                    all_devices - return all devices present in the system.
                    all_devices_verbose - return verbose list of devices.
    /DEVICEENABLEWAKE <devicename> enable the device to wake the system from a
                    sleep state. <devicename> is a device retrieved using
                    the '/DEVICEQUERY wake_programmable' parameter.
    /DEVICEDISABLEWAKE <devicename> disable the device from waking the system
                    from a sleep state. <devicename> is a device retrieved
                    using the '/DEVICEQUERY wake_armed' parameter.
    /HELP, /?       Displays information on command-line parameters.
Examples:
    POWERCFG /LIST
    POWERCFG /QUERY scheme
    POWERCFG /QUERY
    POWERCFG /CREATE scheme
    POWERCFG /DELETE scheme
    POWERCFG /SETACTIVE scheme
    POWERCFG /CHANGE scheme /monitor-timeout-dc 15
    POWERCFG /CHANGE scheme /monitor-timeout-dc 0
    POWERCFG /HIBERNATE on
    POWERCFG /EXPORT scheme /file file
    POWERCFG /QUERY number /NUMERICAL
    POWERCFG /GLOBALPOWERFLAG on /OPTION BATTERYICON
    POWERCFG /AVAILABLESLEEPSTATES
    POWERCFG /BATTERYALARM low
    POWERCFG /BATTERYALARM critical /ACTIVATE on /LEVEL 6 /ACTION hibernate
    POWERCFG /DEVICEQUERY wake_armed
    POWERCFG /DEVICEENABLEWAKE "Microsoft USB IntelliMouse Explorer"
0
 
LVL 14

Accepted Solution

by:
Dhiraj Mutha earned 2000 total points
ID: 33628443
How this helps... copy the below code and paste it in a notepad and save it as POWERCFG.BAT and then you can run it manually or use GPO to deploy it across on all the laptops.
cd\
Powercfg /CREATE Test
Powercfg /CHANGE Test /monitor-timeout-ac 0
Powercfg /CHANGE Test /disk-timeout-ac 0
Powercfg /CHANGE Test /standby-timeout-ac 0
Powercfg /CHANGE Test /monitor-timeout-dc 15
Powercfg /CHANGE Test /disk-timeout-dc 30
Powercfg /CHANGE Test /standby-timeout-dc 25
Powercfg /SETACTIVE Test

Open in new window

0
 
LVL 3

Expert Comment

by:nlandas
ID: 33628476
You can use Powercfg to do so. Perhaps, if you have access to Group Policies you can use this Microsoft document to set it up on a per user/machine basis.

http://support.microsoft.com/kb/915160
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Yucel Altingoz
ID: 33628946
pspglb,
The script is working great except one part

when i close the LID of my portable computer ( Do nothing)
Thanks

0
 
LVL 14

Expert Comment

by:Dhiraj Mutha
ID: 33633554
Hi Alluneed,
Checked and found that POWERCFG does not supprt the advanced changes in power options. I am still giving a try on changing it through GPO. I will keep you posted.
Regards
0
 
LVL 14

Expert Comment

by:Dhiraj Mutha
ID: 33679044
Hi Alluneed,
Apologies for the delay, i was working on the script but did not find anyway to change the advanced options using powercfg. You need to purchase a third party application like InfraSecure or LanDesk Power Management to change the advanced options.
Regards,
PSPGLB
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question