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

By:   |   Updated: 2010-04-09   |   Comments (11)   |   Related: 1 | 2 | 3 | 4 | 5 | 6 | 7 | More > Database Administration


Problem

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.

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.

execute mstsc /admin command from the command prompt

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


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



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.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2010-04-09

Comments For This Article




Friday, June 19, 2020 - 11:20:52 AM - janani Back To Top (86023)

 excellent..it works!


Monday, July 8, 2019 - 4:30:05 AM - venkat Back To Top (81696)

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 (76611)

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


Saturday, April 8, 2017 - 12:09:56 AM - Chris Reynolds Back To Top (54431)

 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 :).

Cheerz,

Chris Reynolds

Kawerau District Council.

 


Friday, April 9, 2010 - 8:32:10 AM - Chuck Hottle Back To Top (5214)

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 9, 2010 - 8:08:44 AM - GaryW Back To Top (5213)

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!

 HTH!

Gary


Friday, April 9, 2010 - 6:11:01 AM - diebieeee Back To Top (5212)

 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 9, 2010 - 6:08:14 AM - jshah.sqldbpool Back To Top (5211)

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


Friday, April 9, 2010 - 6:00:04 AM - DJS Back To Top (5209)

Diebieeee,

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 9, 2010 - 5:59:05 AM - urcuterajendra Back To Top (5208)

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 9, 2010 - 1:52:52 AM - diebieeee Back To Top (5207)

 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,

 















get free sql tips
agree to terms