How to Configure GPO Auto Session Lock in Windows
In this article
You configure automatic session locking through Group Policy by enabling the interactive logon machine inactivity limit, which forces Windows to lock the desktop after a set period of inactivity. The quickest route is to open the Local Group Policy Editor on a single PC, or Group Policy Management Console on a domain, then navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options and set Interactive logon: Machine inactivity limit to your chosen number of seconds. Once enabled, the lock screen appears automatically and the user must sign in again to resume. Policy labels can differ slightly between Windows editions and versions, so look for the closest match if the exact wording is not present.
This setting matters most on shared or kiosk machines, laptops that leave the office, and any endpoint where an unattended unlocked desktop is a real risk. It is a security control, not a screen saver: the screen saver lock is a separate, weaker mechanism that a user can switch off, while the inactivity limit is enforced by policy and cannot be disabled from the sign-in UI.
What You'll Need
- Administrator rights on the target PC, or delegated rights to edit and link a Group Policy Object in Active Directory.
- Windows Pro, Enterprise, or Education for the Local Group Policy Editor. Windows Home does not include gpedit.msc, though domain policy still applies to Home machines that are joined.
- For domain-wide rollout: access to Group Policy Management Console and a test organizational unit to pilot the change.
- A known target timeout in seconds, agreed with users or management before you deploy.
Step-by-Step
- Decide the timeout. The setting is in seconds. A common value is 900 seconds (15 minutes); 600 seconds (10 minutes) is stricter. Write the number down before you start so every machine gets the same value.
- Open the right console. On a standalone PC, press Win+R, type
gpedit.msc, and press Enter. On a domain, open Group Policy Management Console from Administrative Tools, or rungpmc.msc. - Create or select a policy object. For a domain, right-click the organizational unit that contains your target computers, choose Create a GPO in this domain, and Link it here, and give it a clear name such as Workstation Auto Lock. For a single PC, skip this and edit the local policy directly.
- Navigate to the setting. Expand Computer Configuration > Policies > Windows Settings > Security Settings > Local Policies > Security Options.
- Find the inactivity limit. In the right pane, double-click Interactive logon: Machine inactivity limit.
- Enable it and set the value. Select Enabled, type your timeout in the Machine inactivity limit box in seconds, and click OK. Leaving it at 0 disables the lock, so do not leave it at zero.
- Close the editor. The policy is saved as soon as you click OK; no separate save step is needed.
- Apply the policy on the target machine. Open Command Prompt as administrator and run
gpupdate /force. On a domain, wait for the normal refresh cycle or force it the same way. - Verify the result. Run
gpresult /h C:\temp\gpo-report.htmland open the report, or check Interactive logon: Machine inactivity limit under Security Options in the local policy editor after the refresh. Then leave the machine idle for the full timeout and confirm the lock screen appears. - Test sign-in recovery. Sign back in, confirm the desktop resumes normally, and check that the timeout starts counting again from the next period of inactivity.
Common Mistakes
- Entering minutes instead of seconds. Typing 15 gives a 15-second lock, not 15 minutes. Multiply by 60.
- Setting the value to 0. Zero means the feature is off, which is the opposite of what most admins intend.
- Editing the user configuration instead of the computer configuration. The inactivity limit lives under Computer Configuration; a user-side edit will not work.
- Forgetting to link the GPO. A policy object that exists but is not linked to an organizational unit does nothing.
- Assuming a screen saver lock is the same thing. Screen saver settings can be changed by users or overridden; the inactivity limit is enforced separately.
- Deploying to everyone at once. A short timeout on meeting-room or presentation PCs causes constant interruptions. Pilot on a small group first.
Tips
- Keep the value consistent across a department so users build one habit rather than several.
- Pair the lock with a screen saver timeout that is slightly longer, so the two do not fight each other.
- Document the timeout in your onboarding notes; users who know the number are less likely to report the lock as a fault.
- On laptops, remember that the timer pauses during video playback and other activity that counts as input, so a long video will not lock the machine.
- Use a descriptive GPO name and a comment in the policy description so the next admin knows why the value exists.
Troubleshooting
If the machine does not lock, work through these in order:
- Confirm the policy applied. Run
gpresult /rand check that your GPO appears under Applied Group Policy Objects for the computer. - Check for a conflicting policy. A higher-priority GPO or a local policy can override your value. Look at the winning GPO in the gpresult report.
- Force a refresh and restart. Some security settings apply only after a restart, so reboot the machine before concluding the policy failed.
- Check the security policy database. If the setting shows as enabled but nothing happens, run
gpupdate /forceagain and confirm there are no errors in Event Viewer under Windows Logs > System. - Test with a short value. Set 60 seconds temporarily, confirm the lock appears, then restore your intended value.
- Check the edition. On Windows Home, local policy editing is unavailable; the setting must come from domain policy or be configured another way.
Frequently Asked Questions
Does this work on Windows Home?
The Local Group Policy Editor is not included in Windows Home, so you cannot set it locally. Domain-delivered policy still applies to Home machines that are joined to a domain.
What unit is the inactivity limit in?
Seconds. A value of 900 means 15 minutes of inactivity before the lock screen appears.
Will this lock the machine during a long video or presentation?
Activity such as keyboard and mouse input resets the timer. Full-screen video playback generally counts as activity, so the lock usually does not trigger mid-video, but behaviour can vary by app and hardware.
Can users turn the lock off themselves?
No. The inactivity limit is a security setting enforced by policy, not a user preference, so it cannot be disabled from the sign-in or personalisation screens.
Does the lock sign the user out?
No. It locks the session. Open programs and unsaved work remain in place, and the user resumes by signing in again.
How do I remove the setting later?
Set the policy back to Not Configured or Disabled, then run gpupdate /force and restart the affected machines.