How can I automatically log off inactive locked users on domain PCs?

May 11, 2025 5 answers
Asked by pitch.pipe
Hey folks! In my workplace, we've been dealing with a really annoying issue where locked user sessions on our domain PCs aren't logging off automatically. We've set up a 15-minute inactivity lock timeout, but many users still leave their sessions locked instead of logging off. Last week, it led to over 20 users staying logged in on a single machine, which completely overloaded the system and made it unusable. We're looking for a way to automatically log off those inactive locked users, even if another user is working on the machine. We want to manage this through the domain, preferably without any third-party software or agents. We've tried some AI-generated PowerShell scripts, but nothing's been reliable so far. I've even attempted to educate users about logging off, but you know how well that usually goes! If anyone has a working script or a group policy setup that can help with this issue, we'd really appreciate it. Thanks a bunch!

Answers

trellis.rail
Have you thought about setting up nightly restarts? Itโ€™s a straightforward fix that can clear out any idle sessions, though I know itโ€™s not ideal if users are actively using the machines.
Reply to this answer
+12 letter word
You might want to change the screensaver settings to use logoff.exe. That way, when the screensaver kicks in after inactivity, it logs the user off automatically. It's a simple but effective solution!
Reply to this answer
3rd drawer down
Thereโ€™s actually a Group Policy (GPO) setting that can help. We use a shared terminal that logs off inactive users after a couple of hours. It prevents issues with users who forget to log off and just disconnect their sessions. You might want to check the Computer Configuration under Policies and set it up accordingly. If you can, also use Lithnet Idle Logoff for session expiry as well!

~no rush at all: Just a heads up, that GPO only kicks in for RDP connections, not for local sessions. You might still need some other solution for that!

Reply to this answer
DOVETAIL_joint
Itโ€™s essential to know the reason behind wanting to log off these sessions. A lot of solutions might work, but itโ€™s best to have a specific motivation in mind so you can tailor the approach!

needle_7a: Totally agree! Understanding the reason could lead to a more efficient solution. As for the AI-generated scripts, I'd suggest moving away from those if theyโ€™re not reliable.

Reply to this answer
interlocking gears
For shared PCs, I implemented a package that requires the next user to sign off the previous user. It also helps to think about using a tool like idleuserlogoff.exe, which you can set up via GPO. If idle for 30 minutes, it logs off the user automatically!
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions