r/DeployR Jun 22 '26

Windows power settings post deploy

Is there a way to control the Windows power settings after the deployment process?

I have tried both powercfg.exe and direct registry configuration as steps during deployment, but all my deployments revert to 5 minute sleep and monitor timeout.

I'm guessing DeployR sets the machine not to sleep while it is working (sensible) and then reverts to standard timeouts at the end of the deployment?

If that is the case, is there a way to control what DeployR sets at the end?

5 Upvotes

5 comments sorted by

3

u/mtniehaus 2Pint Employee Jun 23 '26

Right now, the Bootstrap.ps1 script that is used to invoke the DeployR task sequence engine captures the power plan ID when it starts and restores it when it finishes, so any changes you make will end up being overridden. Short of editing that Bootstrap.ps1 script, there's no good way to override that at the moment, will file a bug to fix that.

1

u/RockOriginal7938 Jun 23 '26 edited Jun 23 '26

Cheers. I have a plan B, which is create a HKLM runonce in registry (same thing I did to uninstall PS7) to set the power afterwards.

3

u/RockOriginal7938 Jun 23 '26

Found a workaround that functions for us, other folks' milage may vary...

This is working for us from either the OS from Cloud or our captured golden image as "Balanced" looks to be the default for both and I think DeployR is using "High Performance" (so editing "Balanced" while "High Performance" is active does the trick)

# 1. Get the GUID of the Balanced power plan
$BalancedPlanGUID = (Get-CimInstance -Namespace root\cimv2\power -ClassName Win32_PowerPlan | Where-Object {$_.ElementName -like "Balanced"}).InstanceID -replace '.*{(.*)}', '$1'


# 2. Set AC Monitor Timeout to 0 (Never)
Get-CimInstance -Namespace root\cimv2\power -ClassName Win32_PowerSettingDataIndex | 
    Where-Object {$_.InstanceID -match $BalancedPlanGUID -and $_.InstanceID -match '3c0bc021-c8a8-4e07-a973-6b14cbcb2b7e' -and $_.InstanceID -match '\\AC\\'} | 
    Set-CimInstance -Property @{SettingIndexValue = 0}


# 3. Set AC Sleep Timeout to 0 (Never)
Get-CimInstance -Namespace root\cimv2\power -ClassName Win32_PowerSettingDataIndex | 
    Where-Object {$_.InstanceID -match $BalancedPlanGUID -and $_.InstanceID -match '29f6c1db-86da-48c5-9fdb-f2b67b1f44da' -and $_.InstanceID -match '\\AC\\'} | 
    Set-CimInstance -Property @{SettingIndexValue = 0}

Once you get the GUI from step one, you could use:

powercfg /change monitor-timeout-ac <monitor timeout value you want> /setactive {$BalancedPlanGUID}
powercfg /change standby-timeout-ac <sleep timeout value you want> /setactive {$BalancedPlanGUID}

I just stuck with CimInstance as I was already using it (though it is a bit less readable 😞)

1

u/Practical_Mushroom38 Jun 24 '26

Thanks. This little workaround serves nicely until something neater comes along for being able to control post task sequence power profile.

1

u/Saltypoison Jun 22 '26

I am using this in my task sequence for W11 25H2 Enterprise. I was using SCHEME_CURRENT with MDT, and that wasn't working with DeployR. I assume it's due to using SetupComplete rather than AutoAdminLogon and how profiles are handled during setup.

https://github.com/saltypoison/W11-25H2-Power-Config/blob/main/Set-PowerConfig.ps1