Clear user terminal service sessions via command prompt

Ever try to remote desktop or terminal service into a server and get the maximum number of connections has been reached error?  

You could use the GUI interface tsadmin.msc or more recently the Remote Desktop Services Manager to disconnect sessions on the server.  However, if you don't have the GUI tools, you can just use the command prompt.


To display the sessions on your server:
qwinsta /server:[Your Server IP or name]

 SESSIONNAME       USERNAME            ID  STATE   TYPE        DEVICE
 console                                 0  Conn    wdcon
 rdp-tcp                             65536  Listen  rdpwd
                   User1                 2  Disc    rdpwd


To disconnect a sesssion:
rwinsta [ID] /server:[Your Server IP or Name]


Source:
http://www.mydigitallife.info/how-to-remotely-terminate-and-disconnect-remote-desktop-terminal-services-connections-or-sessions/

Comments

Popular posts from this blog

Getting Authentication Prompt When Accessing SharePoint Web Services

How To use ASPNET_SetReg to store encrypted data in the registry and then decrypt the data for use in your app

PowerShell Script to Clean the Windows Installer Directory