A. Windows Server 2003 and Windows XP with Service Pack 2 (SP2) include the Powercfg utility, which lets you set the power configuration options from the command line (which, in turn, you could call from a script). The Microsoft article "How to use Powercfg.exe in Windows Server 2003" offers indepth information about the utility, but its basic usage is as follows:

To view the current power settings, use the /query switch, as the following example and output show:

                              powercfg /query                              Field Description Value                              ----------------- -----                              Name Always On                              Numerical ID 3                              Turn off monitor (AC) After 20 mins                              Turn off monitor (DC) After 15 mins                              Turn off hard disks (AC) Never                              Turn off hard disks (DC) After 30 mins                              System standby (AC) Never                              System standby (DC) Never                              System hibernates (AC) Never                              System hibernates (DC) Never                              Processor Throttle (AC) Not Supported                              Processor Throttle (DC) Not Supported                              

You can also query the settings for a specific scheme (place the scheme in quotes if it contains spaces), as this sample command and output show:

                              powercfg /query "Home/Office Desk"                              Field Description Value                              ----------------- -----                              Name Home/Office Desk                              Numerical ID 0                              Turn off monitor (AC) After 20 mins                              Turn off monitor (DC) After 5 mins                              Turn off hard disks (AC) Never                              Turn off hard disks (DC) After 10 mins                              System standby (AC) Never                              System standby (DC) After 5 mins                              System hibernates (AC) Never                              System hibernates (DC) After 20 mins                              Processor Throttle (AC) Not Supported                              Processor Throttle (DC) Not Supported                              

You can modify individual settings or change the entire scheme by using the /setactive switch, as this example shows:

                              powercfg /setactive "Always On"