Learn more about SQL Server tools

mssqltips logo

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Scripts          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories


Remote Desktop Error terminal server has exceeded the maximum number of allowed connections

By:   |   Updated: 2010-04-09   |   Comments (10)   |   Related: More > Database Administration


As DBAs, we are supporting production servers as well a number of development boxes. On the development boxes apart from DBAs, developers probably also have Admin rights and may sometimes connect to the server remotely. There could be times when developers or other DBAs are not disconnecting their remote desktop sessions or they are connecting to the server using MSTSC. Due to this, we sometimes get the "The terminal server has exceeded the maximum number of allowed connections" message. 

To resolve this so we can connect, we need to disconnect in-active sessions through terminal service manager, but what can we do in the case where all sessions are still active?  To resolve this you can follow the below simple solution.


When trying to connect using a remote desktop session you may get this Login Failure Message, because there are too many remote sessions.

When trying to connect using a remote desktop session you may get this Login Failure Message

To resolve the exceeded connection issue execute "mstsc /admin" command from the command prompt as shown below.


If a terminal server has exceed the maximum number of sessions an "/admin" session can still be created and this will allow you to still connect to the server.

The /admin sessions don't count towards the session limit that may be configured on a terminal server to limit the number of remote sessions, so this will give you a back door into the server if you get the message "The terminal server has exceeded the maximum number of allows connections".

Next Steps
  • Note that this switch was changed for Windows Server 2008 for earlier versions of Windows you will need to use "mstsc /console"
  • Read more about these changes

Last Updated: 2010-04-09

get scripts

next tip button

About the author
MSSQLTips author Jugal Shah Jugal Shah has 8+ years of extensive SQL Server experience and has worked on SQL Server 2000, 2005, 2008 and 2008 R2.

View all my tips
Related Resources

Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 

Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.


Monday, July 08, 2019 - 4:30:05 AM - venkat Back To Top

Many thanks to mssqltips.

Whenever I have an issue whether it is simple or complex, visiting mssqltips will resolve it. Thanks to the authors.

Wednesday, July 11, 2018 - 2:41:18 PM - Rahul Malode Back To Top

 Nice document Jugal!!!!!!!!!

Saturday, April 08, 2017 - 12:09:56 AM - Chris Reynolds Back To Top

 Nice one Jugal. Trying to force my way onto a (2003 Server) remote server on a Saturday when they all went home on Friday night and left their sessions running. Your mstsc /admin is the first tip to do this that has actually worked. Thank you, on a Saturday afternoon that is really appreciated :).


Chris Reynolds

Kawerau District Council.


Friday, April 09, 2010 - 8:32:10 AM - Chuck Hottle Back To Top

I usually just log on to a different server and start Terminal Services manager.  From there, you can connect to the server that is maxed out and decide who to kill or contact about logging off.  You can see the date and time of their last activity, so deciding who to logg off is usually pretty easy.

Friday, April 09, 2010 - 8:08:44 AM - GaryW Back To Top

There's also another way I came across some time ago it is very handy.

 Open a command window and type in qwinsta /server:<server name or IP address>

If RDP is running it will show the logged in users and also have an ID (0,1,2, or 3 generally). Note which one you want to disconnect and type on a new line in the command window:

rwinsta /server:<server name or IP address> ID# {for example say it's ID 1 you want to end because it's a disconnected session, you would type in rwinsta /server:myservername 1

The session will end and you can then log in normally.

Of course, you've got to have admin rights to the server or global admin rights to the domain to do it to other servers, but it's another handy method you can use! It still works in Windows 7 and Server 2008 which is also nice!



Friday, April 09, 2010 - 6:11:01 AM - diebieeee Back To Top

 That must be a contributing factor, since I'm 100% sure that I did NOT get a warning that another user was connected to the admin connection.


Friday, April 09, 2010 - 6:08:14 AM - jshah.sqldbpool Back To Top

This is totally depend on the configuration of WIN2k3, its policies, max connections etc...

Friday, April 09, 2010 - 6:00:04 AM - DJS Back To Top


I am able to get waring in Windows Server 2003.  When i tried mstsc / admin command, i received warning that "there is already user A is connected to box, would you like to end this(Current) session or not". Command did not kick off user A without the warning.

Friday, April 09, 2010 - 5:59:05 AM - urcuterajendra Back To Top

Thanks Jugal,

We are getting max connection issue daily, this is the simple solution. 

I am also getting warning for the kicking off another session. 


Friday, April 09, 2010 - 1:52:52 AM - diebieeee Back To Top

 True, but keep this in mind when you're on a (db)administrators team: /admin only allows *1* user at a time since this uses the console connection.

 I found that (W2K3 at least) doesn't warn about an already active /admin connection.

If user A is already using this connection and user B runs mstsc /admin then user A is kicked off unceremoniously and user B doesn't get a warning that this will happen/has happened,


Learn more about SQL Server tools