Power Management Settings for AC & DC for Laptops

(imported topic written by murtasma91)

I am attempting to create a fixlet to set power management settings for laptops in our envrioment. I used the power mangement wizard to create a fixlet that modifies the Portable/Laptop Scheme. I then modified the action script so it will run using the system account since many of our users here do not have Local Administrator rights. I did this by changing the relevance language (I actually totally rewrote the relevance to just run against laptops here). I then removed the runascurrentuser.exe from the action script.

Here is the action script that is running against my test laptop

// This block of action will only run on Mac 10.4 and higher:

if {name of operating system = “Mac OS X”}

wait pmset displaysleep 15

wait pmset disksleep 15

wait pmset sleep 30

else

// This block of action will only run on Windows Vista computers:

if {name of operating system = “WinVista”}

waithidden cmd.exe /C powercfg.exe -list > __list

if{exists file “__list” whose(exists line whose(it contains “(Portable/Laptop)” ) of it)}

waithidden cmd.exe /C powercfg.exe -setactive {(if(exists lines whose(it contains “(Portable/Laptop)”) of it ) then(preceding text of first “(” of following text of first “:” of concatenations of( lines whose(it contains “(Portable/Laptop)”) of it) of file “__list”) else(“381b4222-f694-41f0-9685-ff5bb260df2e”) ) of file “__list”}

delete __list

else

waithidden cmd.exe /C powercfg.exe -duplicatescheme 381b4222-f694-41f0-9685-ff5bb260df2e > __guid

waithidden cmd.exe /C powercfg.exe -changename {preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))} “Portable/Laptop”

waithidden cmd.exe /C powercfg.exe -setactive {preceding text of last “(” of (following text of first ": " of (line 1 of file “__guid”))}

delete __guid

endif

waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-ac 15

waithidden cmd.exe /C powercfg.exe -change -disk-timeout-ac 15

waithidden cmd.exe /C powercfg.exe -change -standby-timeout-ac 30

waithidden cmd.exe /C powercfg.exe -hibernate on

waithidden cmd.exe /C powercfg.exe -change -hibernate-timeout-ac 80

else

// This block of action will only run on Windows 2000/XP/2003 computers:

if {name of operating system = “Win2000” AND not exists file “powercfg.exe” of system folder}

prefetch powercfg.exe sha1:badfc65a3e245003436d2af816340ebaf0afb6fb size:67072 http://software.bigfix.com/download/bes/util/powercfg2003.exe

utility __Download\powercfg.exe

copy __Download\powercfg.exe “{pathname of system folder & “\powercfg.exe”}”

endif

waithidden “{pathname of system folder & “\powercfg.exe”}” /setactive “Portable/Laptop”

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /monitor-timeout-ac 15

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /monitor-timeout-dc 10

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /disk-timeout-ac 15

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /disk-timeout-dc 10

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /standby-timeout-ac 30

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /standby-timeout-dc 10

waithidden “{pathname of system folder & “\powercfg.exe”}” /hibernate on

waithidden “{pathname of system folder & “\powercfg.exe”}” /change “Portable/Laptop” /hibernate-timeout-ac 80

endif

endif

The real meat is at the bottom of the action script. For some reason when I send this fixlet to my laptop it runs and says each step has been completed when I view the line by line results. However the power management settings are still in correct. I tried running the powercfg switches manually on the laptop using an admin account and they change just fine.

Why isn’t this action properly setting the power configuration settings on this laptop? I have created another action script just like this and modified it in the same fashion for workstations but omitted the switches for the DC power settings and it works just fine on a workstation. The only diffrence in the two fixlets are the DC timeout settings.

(imported comment written by BenKus)

Hello,

What happens if you run the commandline options by-hand with the dc power? Does it work?

Ben

(imported comment written by murtasma91)

Yep it works just fine except of course the account that I am running the command under needs to be an admin account. The thing that baffles me is I have a copy of this fixlet without the DC settings and it correctly sets the AC power settings but when I put the DC settings in both settings don’t work.

Really puzzling me.