I usually have my computers set up to require a login after waking up from sleep or hibernate, but I don't want to enter a password if the screen is just turned off, either from a timeout or if I manually turn off the screen via software. This could be an external monitor that I do not want to turn off with the button on the display or an integrated screen of a laptop.
Up until now, this worked fine on all my desktops and laptops with Windows 10. I even have some desktops running Windows 11 that also do. However, I have a new laptop that runs Windows 11 that always locks the display if the screen is turned off.
If you look at this superuser question you see that a command such as powershell.exe -Command "(Add-Type '[DllImport("user32.dll")]public static extern int SendMessage(int hWnd,int hMsg,int wParam,int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)"
is discussed. Or nircmd is used in this question.
The same is discussed in this question. Or I could just wait the amount of time set in the energy options in Windows.
My problem is, that it does not just turn off the display, but if I try turning the display back on again by hitting some key, I am greeted with a login screen, as if I send the device to sleep. In this case, I want to see the lockscreen, because sleep should lock my device. I disabled modern standby, because it seems to cause problems for me in general and also with this behavior from what I gathered. I also found this post that also discusses my problem, but it does not work for me. It looks a bit different than the 2nd image in the article, it says that Windows should ask for a password after energy savings mode is exited, which is what I want.
So maybe the "turn display off command" is putting my device to sleep instead of just turning my display off. On all my other devices, this work great, but it is driving me crazy on this single machine. How do I configure Windows correctly so that the "turn off display" command (either manually or when I am away for a short time) does NOT lock my screen or sends my device to sleep?
EDIT: Here is screenshot of the new settings panel for login . As you can see, the top option is locked for some reason and the unchecked checkbox below says "permit locking if you are away".