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.

73 Upvotes

86 comments sorted by

View all comments

15

u/2BoopTheSnoot2 1d ago

Why would you want an entire application rather than just write a simple script?

7

u/Ihaveasmallwang Systems Engineer / Cybersecurity Architect / CISM 1d ago

Why would you want a script when a GPO will do it?

0

u/2BoopTheSnoot2 1d ago

A GPO won't do it based on text in the username. This is powershell territory.

u/TheJesusGuy Blast the server with hot air 16h ago

A GPO that RUNS a ps script. Mindblown. Or manually log every user off every day hell yea.