Configure two things: screen sleep and sign-in requirement. This makes Windows lock automatically when idle.
- Turn on automatic lock (require sign-in)
- Open Start > Settings > Accounts > Sign-in options.
- Under Require sign-in, select that Windows will require sign-in when waking from sleep.
- Set a short screen sleep timeout
- Press the Windows key and type Sleep.
- Open the settings for controlling when Windows puts the device to sleep.
- Set the screen (and optionally the PC) to sleep after a short idle time, such as 10–15 minutes.
When the laptop is idle for that period, the screen will turn off, the device will sleep, and on wake it will require sign-in, effectively locking it automatically.
If the device supports presence sensing and it is enabled, also check any Lock on leave or presence-based lock settings so the screen turns off and locks when leaving the device.
References: