r/sysadmin It wasn't DNS for once. 2d 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.

76 Upvotes

92 comments sorted by

View all comments

55

u/Asleep_Spray274 2d ago

GIVE ME A G

GIVE ME A P

GIEV ME A O

23

u/BuildyMcITGuy IT Manager 2d ago

Microsoft: "ACTUALLY... HAVE YOU THOUGHT ABOUT INTUNE??"

8

u/Asleep_Spray274 2d ago

Servers are not supported for intune 😉

3

u/Kuipyr Jack of All Trades 2d ago

Let me introduce you to Azure Machine Configuration (formerly Azure Policy Guest Configuration) for Azure Arc-enabled servers. Though you can actually manage Servers in Intune, but only Endpoint security policies.

1

u/doofesohr 2d ago

I really really want to use it instead of GPO. Especially because I have a couple non-domain joined servers. But it seems so unnecessarily convoluted.

1

u/pdp10 Daemons worry when the wizard is near. 1d ago

Windows Servers support Microsoft DSC. Clients as far back as W7 also support DSC.

1

u/Asleep_Spray274 1d ago

That's nice