Windows – Finding forgotten RDP sessions

domainrdpremotewindows

I work in an enterprise environment with hundreds upon hundreds of Windows servers (all in a single AD domain), both locally and in other countries. I'm often required to log into an RDP session on various servers and, sometimes, I may forget to log off before closing the window. Obviously, this is not ideal, and I'd like to know if anybody knows a way to scan a domain for remote sessions running from my (or another user's, for that matter) account. Thanks!

Best Answer

Why not just set GPOs for the server for session idle timeouts so if you forget about one it automatically logs you off after a certain amount of inactive time. Set it for a couple of hours or more. Worst case you forget when you leave for the day and the servers automatically disconnect you that night.

If you want to do this yourself and actually go look for these suckers you could easily script it out, here's the MSFT CLI docs for TS