How can I disable Windows 11 Dynamic lock while running an attended automation?

There is a registry key that controls it.

https://answers.microsoft.com/en-us/windows/forum/all/dynamic-lock-allow-windows-to-automatically-lock/e1c21a56-f84b-4a80-a1fd-5e79793586ba

And you can use Powershell to edit it.

I am assuming since this particular key is in CURRENT_USER there won’t be any permissions issues with editing it.