Tuesday, March 03, 2009

Windows 2003: Terminate User session remotely

I tried to remote desktop login one of the windows 2003 server but was prompted "The terminal server has exceeded the maximum number of allowed connections.". As this would prolly some sort of CSI required before I could login the server, I was wondering if there is any tool to quickly terminate one of the user session (since there wasn't anyone admit loggin into the server. Browsing through Microsoft site and found PSTools. Below is the steps to kill the connected user session on Windows 2003 (worked for me, atleast):

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 cmd prompt on the server)
Example: psexec \\ -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

Do you have any other alternative to this?

Your Ad Here