Some times we may need to kill the user session remotely when we do not have enough connections to connect through RDP. We will get the message “The terminal server has exceeded the maximum number of allowed connections.” when there are not enough connections to the windows 2000/2003/2008 server.
Microsoft provided some tools (sysinternals) to execute the commands from remote computer.
We should download the sysinternals tools psexec to execute the commands remotely. http://www.microsoft.com/technet/sysinternals/utilities/pstools.mspx
Open your command prompt and from the directory that contains the psexec utility, do the following
1) psexec \\x.x.x.x -u user -p password cmd (this will give you access to the command prompt on the server)
Example: psexec \\127.0.0.1 -u admin -p password cmd
2) once you get the command prompt run the command qwinsta to get a list of all Terminal Services connections. Each connection has an Id Number.
3) Run the command logoff [id# of session to quit] /v (this will kill the connection with that id #)
Example: logoff 2 /v
Once you killed a connection, you can use your remote desktop connection to login to the server remotely.

#1 by Aayush on January 31, 2011 - 12:19 am
Quote
Thanks. This helped me a lot.
#2 by adminitech on August 3, 2011 - 6:52 pm
Quote
Thank you hari for this article, it helped for me in time.
Thanks,
Adminitech
Pingback: Как убить RDP сессию удаленно? | Системное администрирование в киберспорте и не только