Jump to content
Sign in to follow this  
dufran3

Power Policies

Recommended Posts

dufran3

This is what I am trying to do. Change the power settings of a computer. Change everything to "never" and disable hibernate. I would like to accomplish this without having to open up the actual powercfg.cpl control panel. This is what I have. I went under the power settings, changed all the settings to "never" then choose save as, then created a name for it. What happens is, I go look under the control panel when running this on another computer, and the settings are at normal home/office settings, but with the correct power policy name...any help with this would be awsome!

Func PowerPC()
        ;Change Power Profile
    $CurrentPower = "HKCU\Control Panel\PowerCfg\"
    $CurrentPowerVal = RegRead($CurrentPower,"CurrentPowerPolicy")
    $powerpath = "HKCU\Control Panel\PowerCfg\PowerPolicies\6"
    $powerval = Regread($powerpath,"Name")
    RegWrite($powerpath)
    RegWrite($powerpath,"Description","REG_SZ","Everything always on!")
    RegWrite($powerpath,"Name","REG_SZ","Custom PC")
    RegWrite($powerpath,"Policies","REG_BINARY",'01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,05,00,00,00,00,00,00,0,00,00,00,00,78,00,00,00,32,32,03,02,04,00,00,00,04,00, 00,00,00,00,3d,77,2e,f2,07,00,00,00,00,00,3c,00,00,00,00,00,00,00,b4,00,00,00,00,00,64,64,64,64,91,7c')

    If $CurrentPowerVal <> "6" Then
        regwrite($CurrentPower,"CurrentPowerPolicy","Reg_SZ","6")
    EndIf

    ;Disable Hibernate
    _RunDOS("POWERCFG.exe /HIBERNATE off")
    
    ;Log Setting Change
    _LogCheck("1","PowerPC",$powerpath,"Name","Custom PC")
EndFunc
Edited by dufran3

Share this post


Link to post
Share on other sites
dufran3

200 + pc's, not on a domain. Really can't use AD to set this.

Share this post


Link to post
Share on other sites
dufran3

Neg, this little function is a part of a big script I wrote. It is for configuring pc's. Basically, opens a gui on execute, click the options you would like to change/install, then execute, this is one of the options.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.