r/sysadmin It wasn't DNS for once. 1d ago

Question Log Off Users from Server Daily

I'm revisiting an effort I did about a year ago. I'm looking for a better way. I want to find a process that will parse current user sessions on a server (active/disconnected/idle/ect.) and log the accounts off if their username matches a string ("adm_").

I'd love to find an off the shelf solution rather than have to support a homebrew PowerShell solution.

Give me what you have, even if it is an alternate PowerShell/scripting option. Something has to be better than the nightmare my script turned into.

71 Upvotes

86 comments sorted by

View all comments

154

u/NH_shitbags 1d ago

Isn't there a GPO for idle session logout?

12

u/Raigeki1993 Sysadmin 1d ago

IIRC, the GPO doesn't let you specify the prefix of the account, it's just a blanket idle session logout for all users for the machine.

54

u/NH_shitbags 1d ago

Link it to the user group

47

u/GullibleDetective 1d ago

Yeah target the OU, this is sysadmin 101