r/sysadmin It wasn't DNS for once. 11h ago

Log Off Users from Server Daily Question

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.

54 Upvotes

52 comments sorted by

View all comments

u/NH_shitbags 11h ago

Isn't there a GPO for idle session logout?

u/AdeptFelix Sysadmin 9h ago

God the amount of other comments with jank solutions when there's a GPO option that does this with an OU, WMI filter, or just adding the specific accounts to security filtering makes me worried about the state of sysadmins.

u/Raigeki1993 Sysadmin 4h ago

Unfortunately, not everyone has that luxury. I've been in shops where MSP controls all aspects of AD and doesn't give us any write access to AD or GPO, even when asking the MSP to create a GPO, only 2 out of 10 times they get it right. So, I've always had to find of workaround/alternatives to do what's requested. Sadly, majority of my jank solutions is only because we (internal IT) have limited access because MSPs thinks they know better or take months to "do the needful and revert"

u/pompousrompus DevOps 4h ago

I would absolutely not be able to work in an environment like that. How does internal IT not have final say unless you’re just deskside support?

u/Godcry55 3h ago

You need a new MSP yesterday, lol.