User Tools

Site Tools


userspace:win-config-power

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

userspace:win-config-power [2014/01/24 09:20]
Kevin W. Fix: add missing "/"
userspace:win-config-power [2021/08/23 08:37]
Line 1: Line 1:
-====== Win-Config-Power ====== 
-**Feel free to contact me :)** 
  
-Tested with opsi 4.0.3.1\\ 
-requiredWinstVersion >= 4.10.8.3\\ 
-Tested with Windows 7/8 Enterprise x64/x32\\ 
-**Not working for Windows XP**\\ 
-By [[Kevin.Weis@faw.de|Kevin Weis]] 2014-01-22\\ 
- 
-Download: [[https://dl.dropboxusercontent.com/u/27159788/static/win-config-power_1.0-1.opsi | installable opsi package]]\\ 
- 
-<code> 
-Tree: 
-|-- delsub.ins 
-|-- FAW gGmbH.pow 
-|-- once.ins 
-|-- pow_cnfg.png 
-|-- pow_cnfg_full_size.png 
-|-- setup.ins 
-`-- uninstall.ins 
-</code> 
- 
-== What is does, and what not == 
-It Does:\\ 
-  - **Setup** installing default config (.pow file) 
-  - **Uninstall** remove default config (.pow file) and set to selected property "reset_to" (default is "high_performance") 
-  - **Once** customize the default config (.pow file), with the product propertys (values in minutes): 
-    - monitor-timeout-ac 
-    - monitor-timeout-dc 
-    - disk-timeout-ac 
-    - disk-timeout-dc 
-    - standby-timeout-ac 
-    - standby-timeout-dc 
- 
-It Does Not:\\ 
-  - Working for Windows XP 
-  - Turn your computer into an energy-saving-machine 
-  - Report any errors, to winst. 
- 
- 
-== TODO == 
-  - May add Exception-Handling/Error-Reporting. 
- 
- 
-===== delsub.ins ===== 
-<code winst check_uninstall.ins> 
-if $reset_to$ = "high_performance" 
- Set $reset_to_guid$ = $guid_high_performance$ 
-endif 
-if $reset_to$ = "powersave" 
- Set $reset_to_guid$ = $guid_powersave$ 
-endif 
-if  $reset_to$ = "balanced" 
- Set $reset_to_guid$ = $guid_balanced$ 
-endif 
- 
-Message "Reset to: " + $reset_to$ + " (" + $reset_to_guid$ + ")" 
-WinBatch_reset_to 
- 
-Message "Delete: " + $name$ + " (" + $guid$ + ")" 
-WinBatch_Delete 
- 
- 
- 
- 
-[WinBatch_reset_to] 
-powercfg -SETACTIVE "$reset_to_guid$" 
- 
-[WinBatch_Delete] 
-powercfg -DELETE "$guid$" 
- 
-</code> 
- 
-=== once.ins === 
-<code winst delsub.ins> 
-[Initial] 
-setLogLevel=9 
-ExitOnError=True 
-ScriptErrorMessages=on 
-TraceMode=off 
-StayOnTop=True 
- 
-[Actions] 
-Message "Preparing..." 
-DefVar $guid$ 
-DefVar $guid_balanced$ 
-DefVar $guid_high_performance$ 
-DefVar $guid_powersave$ 
-DefVar $name$ 
-DefVar $ProductId$ 
-DefVar $OS$ 
-DefVar $TEMP$ 
-DefVar $MinorOS$ 
-DefVar $reset_to$ 
-DefVar $reset_to_guid$ 
-DefVar $monitor-timeout-ac$ 
-DefVar $monitor-timeout-dc$ 
-DefVar $disk-timeout-ac$ 
-DefVar $disk-timeout-dc$ 
-DefVar $standby-timeout-ac$ 
-DefVar $standby-timeout-dc$ 
- 
-Set $reset_to$ = GetProductProperty ( "reset_to", "high_performance" ) 
-Set $monitor-timeout-ac$ = GetProductProperty ( "monitor-timeout-ac", "0"  ) 
-Set $monitor-timeout-dc$ = GetProductProperty ( "monitor-timeout-dc", "5"  ) 
-Set $disk-timeout-ac$ = GetProductProperty ( "disk-timeout-ac", "0"  ) 
-Set $disk-timeout-dc$ = GetProductProperty ( "disk-timeout-dc", "20" ) 
-Set $standby-timeout-ac$ = GetProductProperty ( "standby-timeout-ac", "0"  ) 
-Set $standby-timeout-dc$ = GetProductProperty ( "standby-timeout-dc", "30" ) 
- 
-set $ProductId$ = "Windows Config Power-Managment" 
-set $OS$ = GetOS 
-Set $TEMP$ = "C:\tmp" 
-set $MinorOS$ = GetNTVersion 
-Set $guid_balanced$ = "381b4222-f694-41f0-9685-ff5bb260df2e" 
-Set $guid_high_performance$ = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" 
-Set $guid_powersave$ = "a1841308-3541-4fab-bc81-f71556f20b4a" 
- 
-Set $name$ = "FAW gGmbH" 
-Set $guid$ = "261d4290-da21-4fac-9f63-309ed29cdcf3" 
- 
-ShowBitmap "%scriptpath%\pow_cnfg.png" $ProductId$ 
- 
-if $reset_to$ = "high_performance" 
- Set $reset_to_guid$ = $guid_high_performance$ 
-endif 
-if $reset_to$ = "powersave" 
- Set $reset_to_guid$ = $guid_powersave$ 
-endif 
-if  $reset_to$ = "balanced" 
- Set $reset_to_guid$ = $guid_balanced$ 
-endif 
- 
-sub "%ScriptPath%\delsub.ins" 
- 
-Message "Import: " + $name$ + " (" + $guid$ + ")" 
-Files_copy_data 
-WinBatch_Import 
-Files_delete_data 
- 
-Message "Set Active: " + $name$ + " ( " + $guid$ + ")" 
-WinBatch_set_active 
- 
-Message "Change: " + $name$ + " (" + $guid$ + ")" 
-WinBatch_change 
- 
-Message "Finnished" 
- 
- 
- 
- 
-[Files_copy_data] 
-copy "%scriptpath%\$name$.pow" "$TEMP$" 
- 
-[Files_delete_data] 
-delete -f "$TEMP$\$name$.pow" 
- 
-[WinBatch_Import] 
-powercfg -IMPORT "$TEMP$\$name$.pow" $guid$ 
- 
-[WinBatch_set_active] 
-powercfg -SETACTIVE $guid$ 
- 
-[WinBatch_change] 
-powercfg -CHANGE -monitor-timeout-ac "$monitor-timeout-ac$" 
-powercfg -CHANGE -monitor-timeout-dc "$monitor-timeout-dc$" 
-powercfg -CHANGE -disk-timeout-ac "$disk-timeout-ac$" 
-powercfg -CHANGE -disk-timeout-dc "$disk-timeout-dc$" 
-powercfg -CHANGE -standby-timeout-ac "$standby-timeout-ac$" 
-powercfg -CHANGE -standby-timeout-dc "$standby-timeout-dc$" 
- 
-</code> 
- 
-=== setup.ins === 
-<code winst setup.ins> 
-[Initial] 
-setLogLevel=9 
-ExitOnError=True 
-ScriptErrorMessages=on 
-TraceMode=off 
-StayOnTop=True 
- 
-[Actions] 
-Message "Preparing..." 
-DefVar $guid$ 
-DefVar $guid_balanced$ 
-DefVar $guid_high_performance$ 
-DefVar $guid_powersave$ 
-DefVar $name$ 
-DefVar $ProductId$ 
-DefVar $OS$ 
-DefVar $TEMP$ 
-DefVar $MinorOS$ 
-DefVar $reset_to$ 
-DefVar $reset_to_guid$ 
-DefVar $monitor-timeout-ac$ 
-DefVar $monitor-timeout-dc$ 
-DefVar $disk-timeout-ac$ 
-DefVar $disk-timeout-dc$ 
-DefVar $standby-timeout-ac$ 
-DefVar $standby-timeout-dc$ 
- 
-Set $reset_to$ = GetProductProperty ( "reset_to", "high_performance" ) 
-Set $monitor-timeout-ac$ = GetProductProperty ( "monitor-timeout-ac", "0"  ) 
-Set $monitor-timeout-dc$ = GetProductProperty ( "monitor-timeout-dc", "5"  ) 
-Set $disk-timeout-ac$ = GetProductProperty ( "disk-timeout-ac", "0"  ) 
-Set $disk-timeout-dc$ = GetProductProperty ( "disk-timeout-dc", "20" ) 
-Set $standby-timeout-ac$ = GetProductProperty ( "standby-timeout-ac", "0"  ) 
-Set $standby-timeout-dc$ = GetProductProperty ( "standby-timeout-dc", "30" ) 
- 
-set $ProductId$ = "Windows Config Power-Managment" 
-set $OS$ = GetOS 
-Set $TEMP$ = "C:\tmp" 
-set $MinorOS$ = GetNTVersion 
-Set $guid_balanced$ = "381b4222-f694-41f0-9685-ff5bb260df2e" 
-Set $guid_high_performance$ = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" 
-Set $guid_powersave$ = "a1841308-3541-4fab-bc81-f71556f20b4a" 
- 
-Set $name$ = "FAW gGmbH" 
-Set $guid$ = "261d4290-da21-4fac-9f63-309ed29cdcf3" 
- 
-ShowBitmap "%scriptpath%\pow_cnfg.png" $ProductId$ 
- 
-sub "%ScriptPath%\delsub.ins" 
- 
-Message "Import: " + $name$ + " (" + $guid$ + ")" 
-Files_copy_data 
-WinBatch_Import 
-Files_delete_data 
- 
-Message "Set Active: " + $name$ + " ( " + $guid$ + ")" 
-WinBatch_set_active 
- 
-Message "Finnished" 
- 
- 
- 
- 
-[Files_copy_data] 
-copy "%scriptpath%\$name$.pow" "$TEMP$" 
- 
-[Files_delete_data] 
-delete -f "$TEMP$\$name$.pow" 
- 
-[WinBatch_Import] 
-powercfg -IMPORT "$TEMP$\$name$.pow" $guid$ 
- 
-[WinBatch_set_active] 
-powercfg -SETACTIVE $guid$ 
- 
-</code> 
- 
-=== uninstall.ins === 
-<code winst uninstall.ins> 
-[Initial] 
-setLogLevel=9 
-ExitOnError=True 
-ScriptErrorMessages=on 
-TraceMode=off 
-StayOnTop=True 
- 
-[Actions] 
-Message "Preparing..." 
-DefVar $guid$ 
-DefVar $guid_balanced$ 
-DefVar $guid_high_performance$ 
-DefVar $guid_powersave$ 
-DefVar $name$ 
-DefVar $ProductId$ 
-DefVar $OS$ 
-DefVar $TEMP$ 
-DefVar $MinorOS$ 
-DefVar $reset_to$ 
-DefVar $reset_to_guid$ 
-DefVar $monitor-timeout-ac$ 
-DefVar $monitor-timeout-dc$ 
-DefVar $disk-timeout-ac$ 
-DefVar $disk-timeout-dc$ 
-DefVar $standby-timeout-ac$ 
-DefVar $standby-timeout-dc$ 
- 
-Set $reset_to$ = GetProductProperty ( "reset_to", "high_performance" ) 
-Set $monitor-timeout-ac$ = GetProductProperty ( "monitor-timeout-ac", "0"  ) 
-Set $monitor-timeout-dc$ = GetProductProperty ( "monitor-timeout-dc", "5"  ) 
-Set $disk-timeout-ac$ = GetProductProperty ( "disk-timeout-ac", "0"  ) 
-Set $disk-timeout-dc$ = GetProductProperty ( "disk-timeout-dc", "20" ) 
-Set $standby-timeout-ac$ = GetProductProperty ( "standby-timeout-ac", "0"  ) 
-Set $standby-timeout-dc$ = GetProductProperty ( "standby-timeout-dc", "30" ) 
- 
-set $ProductId$ = "Windows Config Power-Managment" 
-set $OS$ = GetOS 
-Set $TEMP$ = "C:\tmp" 
-set $MinorOS$ = GetNTVersion 
-Set $guid_balanced$ = "381b4222-f694-41f0-9685-ff5bb260df2e" 
-Set $guid_high_performance$ = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c" 
-Set $guid_powersave$ = "a1841308-3541-4fab-bc81-f71556f20b4a" 
- 
-Set $name$ = "FAW gGmbH" 
-Set $guid$ = "261d4290-da21-4fac-9f63-309ed29cdcf3" 
- 
-ShowBitmap "%scriptpath%\pow_cnfg.png" $ProductId$ 
- 
-sub "%ScriptPath%\delsub.ins" 
- 
-Message "Finnished" 
- 
-</code> 
- 
-=== control === 
-<code winst control> 
-[Package] 
-version: 1 
-depends:  
-incremental: False 
- 
-[Product] 
-type: localboot 
-id: win-config-power 
-name: win-config-power 
-description: Set and Configure Windows Power Options 
-advice: costomize default config with "once" and product propertys. 
-version: 1.0 
-priority: 0 
-licenseRequired: False 
-productClasses:  
-setupScript: setup.ins 
-uninstallScript: uninstall.ins 
-updateScript:  
-alwaysScript:  
-onceScript: once.ins 
-customScript:  
-userLoginScript:  
- 
-[ProductProperty] 
-type: unicode 
-name: reset_to 
-multivalue: True 
-editable: False 
-values: ["balanced", "high_performance", "powersave"] 
-default: ["high_performance"] 
- 
-[ProductProperty] 
-type: unicode 
-name: monitor-timeout-ac 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["0"] 
- 
-[ProductProperty] 
-type: unicode 
-name: monitor-timeout-dc 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["5"] 
- 
-[ProductProperty] 
-type: unicode 
-name: disk-timeout-ac 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["0"] 
- 
-[ProductProperty] 
-type: unicode 
-name: disk-timeout-dc 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["20"] 
- 
-[ProductProperty] 
-type: unicode 
-name: standby-timeout-ac 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["0"] 
- 
-[ProductProperty] 
-type: unicode 
-name: standby-timeout-dc 
-multivalue: True 
-editable: True 
-values: ["0", "10", "20", "30", "5"] 
-default: ["30"] 
- 
-[Changelog] 
-win-config-power (1.0-1) testing; urgency=low 
- -- Kevin Weis <kevin.weis@faw.de>  2014-01-22.1004 +0100 
- * Use "Setup" for installing default config (.pow file) 
- * Use "Uninstall" for remove default config (.pow file) and set to selected property "reset_to" (default is "high_performance") 
- * Use "Once" to costomize the default config (.pow file), with the product propertys (values in minutes): 
-    - "monitor-timeout-ac" 
-    - "monitor-timeout-dc" 
-    - "disk-timeout-ac" 
-    - "disk-timeout-dc" 
-    - "standby-timeout-ac" 
-    - "standby-timeout-dc" 
-  * Tested with Windows 7 Enterprise and Windows 8.1 Professional 
- 
-</code> 
userspace/win-config-power.txt ยท Last modified: 2021/08/23 08:37 (external edit)