Sunday, December 24, 2006

Kill a remote user session remotely

When trying to connect to your Windows 2000/2003 server remotely, you may receive the following error.
"The terminal server has exceeded the maximum number of allowed connections."

You could kill one or more of those connections by using PsExec tool that can be downloaded from the following link. This tool and a bunch of others were developed by SysInternals which was bought by Microsoft.
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 cmd 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.

Digg It! Add to del.icio.us Stumble This

5 Comments:

Uwe Keim said...

Very good tip! Thank you very much.

Francisco Maria said...

Thanks for the trick!Very usefull!

Steven said...

psexec isn't needed if you can ssh into the machine. The "qwinsta" and "logoff" commands are all that would be needed in this case.

梦中林 said...

When the Wow Gold wolf finally found the Buy Wow Goldhole in the chimney he crawled wow gold cheap down and KERSPLASH right into that kettle of water and that was cheapest wow gold the end of his troubles with the big bad wolf.
The next day the cheap wow gold little pig invited his mother over . She said "You see it is just as mygamegoldI told you. The way to get along in the world is to do world of warcraft gold things as well as you can." Fortunately for that little pig, he buy cheap wow gold learned that lesson. And he just k4gold lived happily ever after!

Remote Desktop said...

Its so highly informative things are posted in your blog. I was seeking for this type of blog only and also that you have a fresh and interesting content.
Web Conference