How to View / Disconnect Remote Desktop Sessions from Commandline

by Strider on January 26, 2009

in Tips 'n' Tricks

I used to receive the maximum number of connections error message when I try to log on to the Windows 2003 Server in my office via Windows Remote Desktop.

“The terminal server has exceeded the maximum number of allowed connections“

Session Exceeded

This is pretty annoying if you have some urgent work to do in the server. Most of the already logged in users won’t even be using the session at the time, but I can’t login! So how to solve this? After a bit of googling, as usual, I found a simple way to disconnect other remotely logged in sessions. 😀

First of all you must be logged in to your client computer as a domain Admin user. Now open the command prompt and type in the following command.

qwinsta /server:SERVERIP

The Ip address or domain name of the Remote server should be entered in place of SERVERIP


qwinsta /server:

You will get a list of the Remote Sessions in the command window.

Remote sessions list

In the above sceenshot we can clearly see an Active RDP session with the ID 2 which belongs to the user Administrator. In order to disconnect that user we are going to use the session ID. Use the following command line to disconnect the remote session.

rwinsta /server:SERVERIP SESSIONID

For example in order to terminate the session of the Administrator user the following command should be given.

rwinsta /server: 2

Disconnect Remote Session

Now let’s confirm if the user is really disconnected. Just type in the qwinsta command in proper format.

Disconnected Remote Sessions List

As you can see our session with ID 2 is no longer there. Now for the user we just disconnected will see the following message.


The remote session was disconnected because you session was logged off at the remote computer. Your administrator or another user might have ended your connection.

So we are done with the remote session management over command lines.

{ 38 comments… read them below or add one }


1 March 28, 2012 at 11:55 am Thumb up 0 Thumb down 0

please tell me meaning of session forced out and session forced off



2 April 20, 2012 at 3:53 pm Thumb up 0 Thumb down 0

BRAVO! thanks




3 May 23, 2012 at 12:50 pm Thumb up 0 Thumb down 0

You could use the console-connection with Remote Desktop too. Just launch “mstsc.exe /console” and connect as normal. More information:


Rafik Kureshi

4 October 22, 2012 at 2:27 pm Thumb up 0 Thumb down 0

Thank you very much……..


Klaus Jensen

5 October 24, 2012 at 1:01 pm Thumb up 0 Thumb down 0

Did not work for me, but using the logoff command specified in this article did:



6 November 2, 2012 at 6:48 pm Thumb up 0 Thumb down 0

Excellent , also you can try this :
query session /server:SERVERIP

reset session SESSIONID /server:SERVERIP


Adil Mahmood

7 November 22, 2012 at 5:13 pm Thumb up 0 Thumb down 0


Works perfect



8 January 16, 2013 at 8:41 pm Thumb up 0 Thumb down 0

works for me. Thanks!



9 January 30, 2013 at 10:10 pm Thumb up 0 Thumb down 0

Thank you All of you,

Thanks for sharing information. kindly Tell me how to schedule the all user Session disconnect / session forced out on at time.


10 April 27, 2013 at 12:11 pm Thumb up 0 Thumb down 0

It is truly a nice and helpful piece of info. I’m satisfied that you just shared this useful info with us. Please keep us informed like this. Thank you for sharing.



11 May 9, 2013 at 3:46 am Thumb up 0 Thumb down 0

Hi there colleagues, good article and nice arguments commented here,
I am truly enjoying by these.


genf20 plus

12 May 13, 2013 at 9:10 pm Thumb up 0 Thumb down 0

Hi there, I want to subscribe for this website to take latest updates, thus where can i
do it please help.


komunikacja wewnetrzna

13 May 18, 2013 at 12:08 pm Thumb up 0 Thumb down 0

Whats up are using Wordpress for your blog platform? I’m new to the blog world but I’m trying
to get started and create my own. Do you require any html coding expertise to make your own
blog? Any help would be greatly appreciated!



14 May 20, 2013 at 3:59 pm Thumb up 0 Thumb down 0

No expertise required
Being a casual user would be sufficient for most blogsites



15 May 24, 2013 at 2:15 pm Thumb up 0 Thumb down 0

Superb, what a blog it is! This blog presents helpful information to us, keep it


the best juicer

16 May 26, 2013 at 10:13 am Thumb up 0 Thumb down 0

Excellent blog right here! Additionally your web site a lot up fast!
What host are you the use of? Can I am getting your associate link for your host?
I want my website loaded up as quickly as yours lol



17 June 3, 2013 at 11:27 am Thumb up 0 Thumb down 0

Hey there, I think your blog might be having browser compatibility issues.

When I look at your blog in Ie, it looks fine but when opening
in Internet Explorer, it has some overlapping.

I just wanted to give you a quick heads up! Other then that, fantastic blog!


Joker Beatbox Style

18 June 6, 2013 at 6:33 pm Thumb up 0 Thumb down 0

I do not even know how I finished up here, however I thought this publish was
good. I don’t recognize who you’re but definitely you are going
to a well-known blogger in the event you are not already.



19 June 16, 2013 at 5:36 am Thumb up 0 Thumb down 0

I like what you guys tend to be up too. This kind of clever work and reporting!
Keep up the wonderful works guys I’ve added you guys to blogroll.



20 June 18, 2013 at 2:13 am Thumb up 0 Thumb down 0

Great post. I was checking continuously this blog and I am
impressed! Extremely useful information specifically the last part 🙂 I care for
such information a lot. I was seeking this particular information for a very long time.
Thank you and good luck.



21 June 20, 2013 at 12:59 pm Thumb up 0 Thumb down 0

I have been browsing on-line greater than 3 hours
as of late, yet I by no means found any fascinating article
like yours. It’s lovely worth sufficient for me. In my opinion, if all web owners and bloggers made just right content as you did, the net will likely be a lot more helpful than ever before.


Allison Reining

22 June 21, 2013 at 7:28 pm Thumb up 0 Thumb down 0

Others have voiced my confusion above, but it’s nice sometimes to add for the melee. I’ve been signed up since the middle of January, but have three letters. They’re great letters! But similarly, I’d like to know if this is just the process in the dust settling or if this is to be expected?


ana tranny sex

23 June 30, 2013 at 10:07 am Thumb up 0 Thumb down 0

This article will help the internet people for building up
new website or even a blog from start to end.



24 July 3, 2013 at 6:22 pm Thumb up 0 Thumb down 0

How can I connect direct to my Remote Desktop Connection, Client terminal. Client is connected through Server/client environment using proxy. My server IP Address is XXX.XX.XXX.XXX with client as port 8080. Can anyone help me out. Thanks



25 July 17, 2013 at 1:54 am Thumb up 0 Thumb down 0

Very helpful! I had to deal with this issue every day, for a while and you helped me with your post! Thanks very much.




web site

26 August 8, 2013 at 8:45 am Thumb up 0 Thumb down 0

Wonderful blog! Do you have any helpful hints for aspiring writers?
I’m hoping to start my own site soon but I’m a little lost on everything.
Would you advise starting with a free platform like Wordpress or go for a paid option?
There are so many choices out there that I’m completely overwhelmed .. Any recommendations? Bless you!



27 September 3, 2013 at 10:01 am Thumb up 0 Thumb down 0

Nice tips just a question – Any way to view the applications open in the respective sessions.


electric smoker compare99

28 December 11, 2013 at 2:11 pm Thumb up 0 Thumb down 0

I amm not ѕure where you aare getting your info, but good topic.
I needs to spend some time learning much more or understanding more.

Thanks for wοnderful information І was looking for thijs
info for my miѕsion.


pregnant wisdom toothache

29 December 12, 2013 at 2:24 pm Thumb up 0 Thumb down 0

Whoa! Тhis blog loοkѕ exactly lijke my оld one! It’s on a entirelу different topic but it has pretty much the same
layоut and design. Great choice of cоlors!


30 February 27, 2014 at 4:31 am Thumb up 0 Thumb down 0

Hello There. I discovered your Leo Giamani weblog using msn.
That is a very well written article. I will make
sure to bookmark it and return to learn more of your useful information.

Thanks for the post. I will definitely comeback.



31 March 27, 2014 at 12:34 pm Thumb up 0 Thumb down 0

Hi there it’s me, I am also visiting this site daily,
this web site is in fact good and the viewers are truly sharing nice thoughts.


Aasim Awan

32 April 4, 2014 at 3:31 am Thumb up 0 Thumb down 0

i have tried following on one of my production db ip and get following errors
C:\>qwinsta /server:
Error 5 getting sessionnames
Error [5]:Access is denied.

C:\>query session /server:
Error 5 getting sessionnames
Error [5]:Access is denied.

please provide help regarding this on my email



33 August 29, 2014 at 12:25 pm Thumb up 0 Thumb down 0

I read a lot of interesting articles here. Probably you spend
a lot of time writing, i know how to save
you a lot of time, there is an online tool that
creates unique, google friendly articles in seconds, just type in google – laranitas free content source


34 September 26, 2014 at 9:09 pm Thumb up 0 Thumb down 0

Hi my friend! I want to say that this article is amazing, nice written and include approximately
all significant infos. I would like to see extra posts like
this .


35 October 4, 2014 at 5:30 am Thumb up 0 Thumb down 0

I have beden exploring for a little for any
high quality articles or blog posts onn this kind of space .
Exploring in Yahoo I fiinally stujmbled upon this site. Reading this
info So i am glad to express that I’ve a very excellent uncanny feeling I discovered
just what I needed. I most undoubtedly will make certain to do not overlook this
webb site and give it a look on a constant basis.


Varun Upadhyay

36 February 12, 2015 at 11:20 pm Thumb up 0 Thumb down 0

Bravo!!! Bravo!!! Thanks a lot 🙂



37 February 20, 2016 at 10:30 am Thumb up 0 Thumb down 0

Hi, thanks for speaking about the new Ubuntu release. This is one of the best releases and i have it installed on my rig at home. the only issue is outdated ati driver.



38 November 26, 2016 at 3:07 pm Thumb up 0 Thumb down 0

When use remotely, how are credentials passed and what ports have to be opened?

I want to do:

qwinsta /



Leave a Comment

{ 3 trackbacks }

Previous post:

Next post: