Here is my Action Script:
Action Script
Script Type BigFix Action Script
if {name of operating system as lowercase contains “mac”}
wait pmset -c displaysleep 30
wait pmset -b displaysleep 5
wait pmset -c disksleep never
wait pmset -b disksleep 60
wait pmset -c sleep never
wait pmset -b sleep never
else
if {(name of it = “WinVista” OR name of it = “Win8” OR name of it = “Win7” OR name of it = “Win2008” OR name of it = “Win2008R2” OR name of it = “Win8” OR name of it = “Win8.1” OR name of it = “Win10” OR name of it = “Win2012” OR name of it = “Win2012R2” OR name of it = “Win2016”) of operating system}
waithidden cmd.exe /C powercfg.exe -list > __list
if {exists file "__list" whose (exists line whose (it contains "(Always On)" ) of it)}
waithidden cmd.exe /C powercfg.exe -setactive {(if (exists lines whose (it contains "(Always On)") of it) then (preceding text of first "(" of following text of first ":" of concatenations of (lines whose (it contains "(Always On)") 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"))} "Always On"
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 30
waithidden cmd.exe /C powercfg.exe -change -monitor-timeout-dc 5
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-ac never
waithidden cmd.exe /C powercfg.exe -change -disk-timeout-dc 60
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-ac never
waithidden cmd.exe /C powercfg.exe -change -standby-timeout-dc never
waithidden cmd.exe /C powercfg.exe -hibernate on
waithidden cmd.exe /C powercfg.exe -change -hibernate-timeout-ac never
waithidden cmd.exe /C powercfg.exe -change -hibernate-timeout-dc never
else
prefetch RunAsCurrentUser.exe sha1:ee47505ebfb2790b9da8a20ed70e67158e9753d0 size:342528 http://software.bigfix.com/download/bes/util/RunAsCurrentUser-2.0.3.1.exe sha256:1a9b518c775e2a85a7c47801e9b8221df338a65ad8df326485e4cd2aea22fe52
prefetch regacl-32.exe sha1:cb34e02e8a8366563c9ed61db4ad1fc11ff75100 size:2609248 http://software.bigfix.com/download/PowerManagement/regacl-32.exe SHA256:e37446ea4c9036dfcf51e4b2322ba52eb3f9884fc3a7d33f94764b04d77c17e1
prefetch regacl-64.exe sha1:f11b1da4fd3a94c6717c61ca3d84b86edc2fc99c size:3083776 http://software.bigfix.com/download/PowerManagement/regacl-64.exe SHA256:e2c471f4ae7aa7242749c805d544bb29eafe1955a1b5c624f4c8e1d831afc8b7
prefetch unzip.exe sha1:e1652b058195db3f5f754b7ab430652ae04a50b8 size:167936 http://software.bigfix.com/download/redist/unzip-5.52.exe SHA256:8d9b5190aace52a1db1ac73a65ee9999c329157c8e88f61a772433323d6b7a4a
utility __Download\RunAsCurrentUser.exe
utility __Download\regacl-32.exe
utility __Download\regacl-64.exe
utility __Download\unzip.exe
if {name of operating system = regex "Win(XP|XP-2003)"}
createfile until __EOF
HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\controls folder\powercfg
HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\controls folder\powercfg\globalpowerpolicy
HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\controls folder\powercfg\powerpolicies
{concatenation “%0d%0a” of (“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies” & it as string & “”) of (names of keys of keys “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies” of registry)}
{concatenation “%0d%0a” of (“HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\controls folder\powercfg\processorpolicies” & it as string & “”) of (names of keys of keys “hklm\software\microsoft\windows\currentversion\controls folder\powercfg\processorpolicies” of registry)}
HKEY_LOCAL_MACHINE\software\microsoft\windows\currentversion\controls folder\powercfg\processorpolicies
HKEY_LOCAL_MACHINE\system\currentcontrolset\control\session manager\power
HKEY_USERS.default\control panel\powercfg
HKEY_USERS.default\control panel\powercfg\globalpowerpolicy
HKEY_USERS.default\control panel\powercfg\powerpolicies
{concatenation “%0d%0a” of (“HKEY_USERS.default\control panel\PowerCfg\PowerPolicies” & it as string & “”) of (names of keys of keys “HKEY_USERS.DEFAULT\Control Panel\PowerCfg\PowerPolicies” of registry)}
__EOF
delete regkeys.txt
move __createfile regkeys.txt
createfile until __EOF
@echo off
del /F regacl_backup.txt
FOR /F “tokens=*” %%a IN (regkeys.txt) DO (
del /F backup_temp.txt
__Download\regacl-32.exe -a allow -k “%%a” -b backup_temp.txt
type backup_temp.txt >> regacl_backup.txt
)
__EOF
delete run_setacl.bat
move __createfile run_setacl.bat
waithidden run_setacl.bat
if {x64 of operating system}
createfile until __EOF
@echo off
del /F regacl_backup64.txt
FOR /F “tokens=*” %%a IN (regkeys.txt) DO (
del /F backup_temp.txt
__Download\regacl-64.exe -a allow -k “%%a” -b backup_temp.txt
type backup_temp.txt >> regacl_backup64.txt
)
__EOF
delete run_setacl.bat
move __createfile run_setacl.bat
waithidden run_setacl.bat
endif
endif
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /setactive "Always On"
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /monitor-timeout-ac 30
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /monitor-timeout-dc 5
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /disk-timeout-ac never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /disk-timeout-dc 60
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /standby-timeout-ac never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /standby-timeout-ac never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /standby-timeout-dc never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /standby-timeout-dc never
waithidden "{pathname of system folder & "\powercfg.exe"}" /hibernate on
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /hibernate-timeout-ac never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\powercfg.exe"}" /change "Always On" /hibernate-timeout-dc never
waithidden __Download\RunAsCurrentUser.exe --q "{pathname of system folder & "\rundll32.exe"}" powrprof.dll,LoadCurrentPwrScheme
if {name of operating system = regex "Win(XP|XP-2003)"}
waithidden __Download\regacl-32.exe -a restore -b regacl_backup.txt
if {x64 of operating system}
waithidden __Download\regacl-64.exe -a restore -b regacl_backup64.txt
endif
endif
endif
endif
Trying to setup on a Windows 10 machine.