Sleep or not to sleep - my problems with Windows 11 power plans on Framework 13 Pro

Why does Windows 11 make everything so hard…

I’m posting this in case anyone else has similar needs.

Here is the background:

I have just installed Windows 11 Pro on my framework 13 Pro and have come across several major (for me) issues with power configurations.

First of all, this is my use case. I use my framework Pro for coding/application development. This machine is Entra-joined using Windows 11 25H2 build 26200.

Most of my time is spent in the office with the framework on AC power. However I also have to travel to customers every so often so also want to get as much battery life as possible when on DC. I think this is not an uncommon use case for this computer.

This works well so long as I am at the machine working. However sometimes I need to build and deploy my application, which takes about 3 hours to build and upload - I only do this when on AC power.

Here are where my problems start. Part of my build process uses a safenet dongle for code signing. Because there are 50+ applications and dynamic libraries that need to be signed I have setup the dongle to remember it’s password for each session so that I only need to login once. Also, I just want to start the build and then go do something else while it runs.

However the first time I ran a build and returned later I was greeted with the Windows Hello prompt and a build failure. No problem I thought, just switch off the lock screen - I go to the power options and setup that on AC the screen still turns off after 10 minutes but closing the lid does nothing - never sleeps. I think that should do it, the computer will just keep building in the background.
Next build run, exactly the same result, how? I told Windows to just turn off the display and never sleep. It used to work in Windows 10.

The problem is that I could not find any settings to fix this. No matter what I did following all of the conflicting advice on the internet, nothing worked. All I wanted to do is turn off the requirement to sign-in when on AC but Windows knows better and had hidden everything - there was absolutely nothing more in the UI.

Here is the solution that I am using:

I’m by no means a Windows expert, in fact I only use it because I need the development environment.

So if anyone knows a better solution please let me know. I actually had to use Claude in order to find a solution.
What we (well mostly Claude) found was the following:

Modern Standby was enabled. If this is set then many power settings are hidden and/or ignored. Windows has decreed that if you move away from the machine it will lock, which I suppose is valid for some office situations but not for my case.
Worse still, it seemed that Modern Standby makes display-off into sleep. When ‘powercfg /a’ was ran it reported that only ‘Standby (S0 Low Power Idle)’ was available. Looking at the logs, kernel-power logged ‘566’ (display off) and ‘506’ (standby entry) within the same second every time. Standby powered down the USB and so I lost the code signing dongle. So the real problem is not the lock screen but that display off is basically the same as sleep.
The only work-around would be to never turn off the screen which seems pretty wasteful for 3 hour unattended builds.

Ok, turn that off with elevated powershell:

New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Power' -Name PlatformAoAcOverride -Value 0 -PropertyType DWord -Force

followed by a reboot. After doing this the only option I have is hibernate - all other power states are not supported by the firmware.

However, even with Modern Standby off the session still locked. We needed to again look through all of the logs to discover that windows would actually lock the console on monitor power-off. So we also had to add:

# do not require sign-in on AC; do require it on battery
powercfg -attributes fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 -ATTRIB_HIDE
powercfg /SETACVALUEINDEX SCHEME_CURRENT fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT fea3413e-7e05-4911-9a71-700331f1c294 0e796bdb-100d-47d6-a2d5-f7d2daa51f51 1

# never hibernate on AC (protects long unattended builds); hibernate after 10 min on battery
powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_SLEEP 9d7815a6-7ee4-497e-8888-515a05f02364 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_SLEEP 9d7815a6-7ee4-497e-8888-515a05f02364 600

# lid: do nothing on AC, hibernate on battery
powercfg -attributes 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 -ATTRIB_HIDE
powercfg /SETACVALUEINDEX SCHEME_CURRENT SUB_BUTTONS 5ca83367-6e45-459f-a27b-476b1d01c936 0
powercfg /SETDCVALUEINDEX SCHEME_CURRENT SUB_BUTTONS 5ca83367-6e45-459f-a27b-476b1d01c936 2

powercfg /SETACTIVE SCHEME_CURRENT

These settings were absent from the power scheme and only became settable after Modern Standby was disabled.

What I end up with:

AC Battery
Display off 300 s 180 s
Locks on display off no yes
Sleep no state exists no state exists
Hibernate after idle never 600 s
Lid close do nothing hibernate

Tradeoffs:
Security: On AC my machine no longer locks when the screen goes dark. For me this is not a problem in the office and I always hit ‘Win+L’ if at a customer.
Power: It hibernates rather than sleeps. I do not see any real difference between the two other than restarting is a few seconds longer.

I would like to know if there was a more simple way to do this and if turning off Modern Standby has any downsides.