Disconnect Remote session from a remote server though Command line when you really in need to kill session on the server.
Hi Everyone !!
During routine work, I came across an issue that was related to sessions on a remote server. By default a windows server can allow two active Remote session with administrative access. So, if there are two already connected, third one cannot be connected. However windows has procedure to send a kill request to idle connections on the server and after few min's process, it disconnects the old connection and then allow new ones to join.
In worse cases, it happens that active connection gets hanged and you regularly see below screen. And it does not allow new user to get on to the server.
And we need to forcefully kill the sessions for active sessions. Microsoft provides pretty cool tools for this.
Solutions:-
First we need to verify what credentials are connected on the remote server , we are trying to connect to.
On your local machines, go to Command prompt and open it as administrator. Type the command below as in screen shot in yellow where rdc1 is a server in my private lab. In the result , you see it listed all the sessions running on the server along with other imp information such as status, Idle Time and even with Logon Time.
Now you have decided which connection you want to kill to. Note the ID for the connection and shoot below command on command prompt again.
logoff /server:rdc1 3 /v
here 3 is session ID and /v is a switch will show up the event which is happening after shooting the logoff command i.e "Logging off session ID 3".
Do repeat for all session ID's if you want to kill them all. And to verify , give the first command again & you will see that sessions you want to kill, are killed brutally :P
Hit like or share if you like the trick.