How to find out what RDP sessions I’m currently logged in to

remote desktopwindows-xp

Is there a quick way to find out which servers I'm currently remoted in to? I'm running Windows XP on my computer, and I've closed all my rdp windows but didn't log off, and I'd like to know if there is a way for me to find out all the servers that I'm currently rdp'ed to.

Thanks!

Best Answer

netstat -an |find "3389"

This shows all open connections, and then filters to only show matches for 3389 (the normal RDP port). This shows the other endpoint (the server you're connected to). This will also show any machines that have 3389 connected to you, as well.

/Edit - I think this might not be the answer you're looking for? You want to know all machines that you're no longer connected to, but have a disconnected session open on? You'll have to query each machine - I hope you're in a domain.

So - get a list of all servers in your domain (and/or whatever machines might be in question.) Put it in a file called servers.txt. Run :

for /f %s in (servers.txt) do (echo %s & qwinsta /server:%s )