[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Command line to close RDP sessions

Posted on 2009-04-30
6
Medium Priority
?
2,342 Views
Last Modified: 2013-11-21

can someone write down here a command line that can close terminal services session?
sometimes I try to RDP to a machine and it says something about the maximum connection reached.

Thanks
0
Comment
Question by:jskfan
6 Comments
 
LVL 97

Accepted Solution

by:
Lee W, MVP earned 500 total points
ID: 24273011
Install the Adminpak.msi on your computer and then use the Terminal Services Manager MMC to connect to the remote system and close the idle/disconnected sessions.  (I know of no command line that will do it),.
0
 
LVL 13

Assisted Solution

by:marine7275
marine7275 earned 500 total points
ID: 24273041
These will also work:
mstsc -v:servername -console
"reset session sessionid /server:theserver_or_ip"
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Assisted Solution

by:4rmAdam
4rmAdam earned 500 total points
ID: 24277118
Just to add on further to here, usually the "Server has reached its maximum number of connection" error occurs due to the fact that the server is set to accept the default number of concurrent connections, which is 2 RDP & 1 Console switch.

Try using the console switch "mstsc servername /console" and check if your able to log in.  If still cannot then, you may try marine7275: to log off any users remotely from another server.  However, you will need to find out which sessions are active or disconnected before that, use below to check it:

QUERY USER /server"servername_or_ip
 This should return the list of users logged onto the server at that point in time, check for the "ID" and the "State" column and jot down the ID for only disconnected users, if there are any.

Then to log off the session user the "reset session sessionid /server:theserver_or_ip" this should free up one connection for yourself.  Hope this helps.

Br,

Adam
0
 

Author Comment

by:jskfan
ID: 24285479
when I run this command:
QUERY USER /server"servername_or_ip

I get this:

'query' is not recognized as an internal or external command,
operable program or batch file.
0
 

Assisted Solution

by:StarAdam
StarAdam earned 500 total points
ID: 24288515
Ooops just noticed that the command is with the : not " that is why you get the incorrect operator error.

QUERY USER /server:servername_or_ip

And then do the rest of the troubleshooting i.e.:

Check for the "ID" and the "State" column and jot down the ID for only disconnected users, if there are any. Then to log off the session user by:
RESET SESSION sessionid /server:server_or_ip"      

This should free up one connection for yourself.  Let us know how to get on.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Understanding the various editions available is vital when you decide to purchase Windows Server 2012. You need to have a basic understanding of the features and limitations in each edition in order to make a well-informed decision that best suits …
Know what services you can and cannot, should and should not combine on your server.
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question