Mike

Windows Forum Admin
Staff member
Premium Supporter
Joined
Jul 22, 2005
Messages
8,984
The following is an instruction on how to have some semblance of a Power Management group policy in an environment operating under Windows XP and Windows Server 2003. Unfortunately, the Power Management options in XP, as opposed to Vista, are stored in binary files, thereby making it difficult to control Power Options with Group Policy and reduce electrical costs. Fortunately, however, Microsoft released "powercfg.exe", which is a command line tool that will allow you to create a logon script for controlling the power management settings of computers on Active Directory. It is interesting to note that Microsoft has released a lot of command line tools, for example defrag.exe, which would allow a lot of tasks which are automated in Windows Vista to be accomplished using batch scripts in XP.

The logic of power management on legacy systems such as Windows Server 2003\Windows XP is that an older processor draws more power, usually around 80-120 watts on idle. While in standby mode it will be using 10-15 watts.

Here is the code for the batch file / login script. You should store this at \\server\netlogon\power.bat. If you using Windows Server 2003 Small Business Server, you can edit \\server\netlogon\SBS_LOGIN_SCRIPT.bat and have it call \\server\netlogon\power.bat by editing SBS_LOGIN_SCRIPT.bat and adding at the bottom:

Code:
\\server\netlogon\power.bat
For compatibility reasons, you can take a copy of the powercfg.exe binary out of c:\windows\system32\ and copy it to \\server\netlogon\

Here is the code for power.bat:

Code:
REM This bat-file applies Custom1 Power Management Settings
@echo off
net use x: \\server\netlogon
x:
powercfg.exe /CREATE Custom1
powercfg.exe /CHANGE Custom1 /monitor-timeout-ac 15
powercfg.exe /CHANGE Custom1 /monitor-timeout-dc 15
powercfg.exe /CHANGE Custom1 /disk-timeout-ac 60
powercfg.exe /CHANGE Custom1 /disk-timeout-dc 60
powercfg.exe /CHANGE Custom1 /standby-timeout-ac 180
powercfg.exe /CHANGE Custom1 /standby-timeout-dc 180
powercfg.exe /CHANGE Custom1 /hibernate-timeout-ac 360
powercfg.exe /CHANGE Custom1 /hibernate-timeout-dc 360
powercfg.exe /CHANGE Custom1 /processor-throttle-ac ADAPTIVE
powercfg.exe /CHANGE Custom1 /processor-throttle-dc ADAPTIVE
powercfg.exe /SETACTIVE Custom1
c:
net use x: /delete
Ostensibly, what this code does is map\mount "\\server\netlogon" to the X:\ drive on the local system, then it executes the creation of a new Power Scheme called Custom1, it sets monitor timeout to 15 minutes, hard disk timeout to 60 minutes, standby to 3 hours, and hibernation, if available, to 6 hours. It then dismounts/unmaps drive X:

Again, this can be deployed from Windows Server 2003 to lower power consumption costs on idle systems running obsolete software.

If you are using an environment where the Active Directory users are not Administrators on their local machines, but are in fact Limited Accounts, you will have a problem because Windows XP will inherit the Power Options from the Administrator account. To remedy this, you can go into Group Policy on the server, Computer Settings, Registry, and set the following keys to be writable by EVERYONE in Active Directory:

Code:
MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg
MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power
USERS\.DEFAULT\Control Panel\PowerCfg
Set "Replace existing permissions on all subkeys with inheritable permissions" for all 3 of these keys.

With the right policies in place, you can lower the total cost of ownership on your network, even if it is going the way of the dinosaur!

As a Scheduled Task:

Youcan apply a scheduled task to standby/hibernate Windows XP computers at a given time by executing this command in the Scheduled Task:

Code:
rundll32.exe powrprof.dll,SetSuspendState 1 1 0
 


Solution
The instructions provided give a detailed overview of how to implement power management settings in environments running Windows XP and Windows Server 2003 using a batch file and command line tools. Here's a breakdown of the steps and code snippets provided:

Batch File Setup:​

  1. Location for the Batch File:
    • Save the batch file with the provided code at \\server\netlogon\power.bat.
    []Server Configurations:
    • For Windows Server 2003 Small Business Server, you can edit \\server\netlogon\SBS_LOGIN_SCRIPT.bat to call \\server\netlogon\power.bat by adding the line:
      Code:
       \\server\netlogon\power.bat
    [
    ]Powercfg.exe Binary:
    • For compatibility, you can...
The instructions provided give a detailed overview of how to implement power management settings in environments running Windows XP and Windows Server 2003 using a batch file and command line tools. Here's a breakdown of the steps and code snippets provided:

Batch File Setup:​

  1. Location for the Batch File:
    • Save the batch file with the provided code at \\server\netlogon\power.bat.
    []Server Configurations:
    • For Windows Server 2003 Small Business Server, you can edit \\server\netlogon\SBS_LOGIN_SCRIPT.bat to call \\server\netlogon\power.bat by adding the line:
      Code:
       \\server\netlogon\power.bat
    [
    ]Powercfg.exe Binary:
    • For compatibility, you can copy powercfg.exe from C:\Windows\System32\ to \\server\netlogon\.

      Contents of power.bat:​

      Code:
      @echo off REM This bat-file applies Custom1 Power Management Settings net use x: \\server\netlogon x: powercfg.exe /CREATE Custom1 powercfg.exe /CHANGE Custom1 /monitor-timeout-ac 15 powercfg.exe /CHANGE Custom1 /monitor-timeout-dc 15 powercfg.exe /CHANGE Custom1 /disk-timeout-ac 60 powercfg.exe /CHANGE Custom1 /disk-timeout-dc 60 powercfg.exe /CHANGE Custom1 /standby-timeout-ac 180 powercfg.exe /CHANGE Custom1 /standby-timeout-dc 180 powercfg.exe /CHANGE Custom1 /hibernate-timeout-ac 360 powercfg.exe /CHANGE Custom1 /hibernate-timeout-dc 360 powercfg.exe /CHANGE Custom1 /processor-throttle-ac ADAPTIVE powercfg.exe /CHANGE Custom1 /processor-throttle-dc ADAPTIVE powercfg.exe /SETACTIVE Custom1 c: net use x: /delete

      Functionality:​

    • The batch file maps/mounts \\server\netlogon to the X:\ drive, creates a new Power Scheme, sets various timeout settings for monitor, hard disk, standby, hibernation, and processor throttle, and finally sets Custom1 as the active power scheme before unmapping X:\ drive.

      Group Policy for Limited Accounts:​

    • To apply these settings when users are not administrators, update permissions in Group Policy on the server to make specific registry keys writable by EVERYONE in Active Directory. Keys to update:
      Code:
       MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Power USERS\.DEFAULT\Control Panel\PowerCfg

      Scheduled Task for Standby/Hibernate:​

    • To automate standby/hibernation, you can create a scheduled task with the following command:
      Code:
       rundll32.exe powrprof.dll,SetSuspendState 1 1 0
      Implementing these steps will help in effectively managing power consumption in legacy systems like Windows XP and Windows Server 2003, reducing costs and optimizing energy usage.
 


Solution
Back
Top