Difference between revisions of "Power Settings"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(add powercfg for win XP section)
(Configure Power Management with powercfg in Windows XP: typo)
Line 98: Line 98:
 
     <!-- Allow hibernate -->
 
     <!-- Allow hibernate -->
 
     <upgrade cmd='powercfg /HIBERNATE on' />
 
     <upgrade cmd='powercfg /HIBERNATE on' />
    <!-- Remove Screen savers -->
 
  
 
     <remove cmd='reg delete "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg" /v "Version" /f' />
 
     <remove cmd='reg delete "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg" /v "Version" /f' />

Revision as of 11:07, 8 February 2012

Allow Users to Change Power Settings

One of the most annoying things about Windows XP (and maybe later) is that users have to be in the admin group to change the power profile on their PC. This changes that!

This gives end users the exact rights they need to change power settings and no more.

This package relies on the SetACL tool and the powercfg tool which is available in Windows XP SP2 onwards.

Many thanks to the folks here and here.

<?xml version="1.0" encoding="UTF-8"?>

<packages>
  <package
    id='powerconfig'
    name='Allow Users to Change Power Settings'
    revision='1'
    priority='800'
	reboot='false'>
	
	<check type="registry" condition="equals" path="HKLM\Software\xxxxx\wpkg\powerconfig" value="1"/>
	
	<install cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey"' />
	<install cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey"' />
	<install cmd='"%SOFTWARE%\system\powercfg.exe" /setactive "Always On"' />
	<install cmd='REG ADD HKLM\SOFTWARE\xxxxx\wpkg\ /v "powerconfig" /d "1" /t REG_DWORD /f' />
	
	<upgrade cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey"' />
	<upgrade cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey"' />
	<upgrade cmd='"%SOFTWARE%\system\powercfg.exe" /setactive "Always On"' />
	<upgrade cmd='REG ADD HKLM\SOFTWARE\xxxxx\wpkg\ /v "powerconfig" /d "1" /t REG_DWORD /f' />

        <remove cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey;m:revoke"' />
	<remove cmd='"%SOFTWARE%\system\setacl.exe" -on "HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies" -ot reg -actn ace -ace "n:users;p:set_val,create_subkey;m:revoke"' />
        <remove cmd='REG DELETE HKLM\SOFTWARE\xxxxx\wpkg\ /v "powerconfig" /f' />
  </package>
</packages>


Configure Power Management with powercfg in Windows XP

Since Windows XP SP2 powecfg.exe can be used to manage Power schemes. This can be used as a GreenIT tool to manage the power consumption of the computers. This can be used in combination with PowerOff to shutdown computers at night if the hibernate mode is not used.

For WindowsXP PowerCfg options see : http://ss64.com/nt/powercfg-xp.html

This script is inspired from : http://www.energystar.gov/index.cfm?c=power_mgt.pr_power_mgt_powerconfig

<?xml version="1.0" encoding="UTF-8"?>

<!-- Configure Energy settings -->

<packages>
  <package id="powercfg" name="Configure energy settings" revision="%PKG_VERSION%" reboot="false" priority="80">
    <variable name="PKG_VERSION" value="1" />

    <check type="logical" condition="or">
      <check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg\Version" value="%PKG_VERSION%" />
      <check type="logical" condition="not">
        <!-- Only if Windows XP -->
        <check type="registry"  condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName" value="Microsoft Windows XP" />
      </check>
    </check>

    <install cmd='reg add "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg" /v "Version" /d "%PKG_VERSION%" /t REG_SZ /f' />
    <!-- Use powercfg do create a power management scheme -->
    <install cmd='powercfg /CREATE Economic' />
    <install cmd='powercfg /CHANGE Economic /monitor-timeout-ac 20' />
    <install cmd='powercfg /CHANGE Economic /monitor-timeout-dc 10' />
    <install cmd='powercfg /CHANGE Economic /disk-timeout-ac 20' />
    <install cmd='powercfg /CHANGE Economic /disk-timeout-dc 10' />
    <install cmd='powercfg /CHANGE Economic /standby-timeout-ac 20' />
    <install cmd='powercfg /CHANGE Economic /standby-timeout-dc 10' />
    <install cmd='powercfg /CHANGE Economic /hibernate-timeout-ac 0' />
    <install cmd='powercfg /CHANGE Economic /hibernate-timeout-dc 60' />
    <install cmd='powercfg /CHANGE Economic /processor-throttle-ac ADAPTIVE' />
    <install cmd='powercfg /CHANGE Economic /processor-throttle-dc ADAPTIVE' />
    <install cmd='powercfg /SETACTIVE Economic' />
    <!-- Allow hibernate -->
    <install cmd='powercfg /HIBERNATE on' />

    <upgrade cmd='reg add "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg" /v "Version" /d "%PKG_VERSION%" /t REG_SZ /f' />
    <!-- Use powercfg do create a power management scheme -->
    <upgrade cmd='powercfg /CREATE Economic' />
    <upgrade cmd='powercfg /CHANGE Economic /monitor-timeout-ac 20' />
    <upgrade cmd='powercfg /CHANGE Economic /monitor-timeout-dc 10' />
    <upgrade cmd='powercfg /CHANGE Economic /disk-timeout-ac 20' />
    <upgrade cmd='powercfg /CHANGE Economic /disk-timeout-dc 10' />
    <upgrade cmd='powercfg /CHANGE Economic /standby-timeout-ac 20' />
    <upgrade cmd='powercfg /CHANGE Economic /standby-timeout-dc 10' />
    <upgrade cmd='powercfg /CHANGE Economic /hibernate-timeout-ac 0' />
    <upgrade cmd='powercfg /CHANGE Economic /hibernate-timeout-dc 60' />
    <upgrade cmd='powercfg /CHANGE Economic /processor-throttle-ac ADAPTIVE' />
    <upgrade cmd='powercfg /CHANGE Economic /processor-throttle-dc ADAPTIVE' />
    <upgrade cmd='powercfg /SETACTIVE Economic' />
    <!-- Allow hibernate -->
    <upgrade cmd='powercfg /HIBERNATE on' />

    <remove cmd='reg delete "HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\wpkg_powercfg" /v "Version" /f' />
    <remove cmd='powercfg /DELETE Economic' />

  </package>
</packages>