https://www.elevenforum.com/t/automatically-lock-computer-after-inactivity-in-windows-11.4774/
- Open Local Security Policy (secpol.msc).
- Double click/tap on Local Policies in the left pane to expand, and click/tap on Security Options to open it. (see screenshot below)
- In the right pane of Security Options, double click/tap on the Interactive logon: Machine inactivity limit policy to open its properties. (see screenshot above)
- Enter a number between 0 to 599940 for how many seconds of inactivity you want to automatically lock computer after, and click/tap on OK. (see screenshot below)
- The default is 0 (zero) seconds to not automatically lock the computer.
- Close the Local Security Policy window.
- Restart the computer to apply.