Wednesday, March 24, 2010

End RDP Session Remotely

Another note. I'm sure it happened a lot of times for somebody who has worked on a Windows Server. You can't log in because the terminal service allows only 2 connections. Error message is: "Terminal Server has exceeded the maximum number of allowed connections." This happened to me when my Windows XP crashed while RDP'd to one of our servers. Problem is I can't log in again to that particular server. Here's what I did in command line to end my session remotely so I can log back in.

Try the following command from your local machine. If 'query' command isn't working, you can try logging in to another server or machine that has 'query' command enabled, then do the following...

5 comments:

Chris said...

You can do this from a local command line as well with admin rights. You dont need to do this from "another server"

samdc said...

Hi Chris, thanks for your comment. Not sure what Windows you're using, but on my WinXP, when I issue the "query session" command in command line, I get the error message: "'query' is not recognized as an internal or external command, operable program or batch file." So it could be some config missing in my box. Others might encounter the same issue so the above procedure is a sure bet to work. All Windows Servers have "query" command enabled.

Anonymous said...

Worked flawlessly, thank you!

BDog! said...

Now, why would you want to run it locally? That would defeat the whole purpose. The gist of this tool is to remotely end a locked up session.

samdc said...

I updated my post. The thing is, in my old Windows XP, 'query' command is nowhere to be found, so I had to login to another machine ( a Windows Server) that has the 'query' command for me to kill sessions.