I'm looking for some ideas on how to disconnect, logoff, or reset a user's session in a 2008 Terminal Server (unable to login as the user either as it is completely locked-up). This is a production environment, so rebooting the server or doing something system-wide is out of the question for now. Any Powershell tricks to help us with this?
We've tried to disconnect, log the user off and reset the session as well as killing the session's processes too, directly from the same terminal server (from the task manager, Terminal Services Manager and the Resource Monitor) with no results.
Help!
UPDATE: We ended up rebooting the server as no other attempts that we could think of worked. I'll leave this question open hoping someone might have more information about this one issue, and it's potential fixes
What worked for me to resolve this same issue was to kill off all the processes running under the locked account from under Task Manager and then I was able to simply log off that account (from an Administrator account).
The user was then able to log back on under the account.
No reboot was necessary and no third party software needed to be downloaded.
I want to share how I reset of the account without the need to reboot the server. First of all you need to have administrator access to the server. I use the following logon option: mstsc /v:servername /console /admin in order to access the server. Then in "Windows Taks Manager", go to the Users tab and proceed to do a right click over the account that you want to "Log Off", select log off. This should free the locked session used by that account.
The simple answer is to run an elevated command prompt and type "Taskmgr" and then it will allow you to logoff the sessions under the USERS tab. It will not work without being in the elevated session.
I suppose the same happened today on my Win2008R2 Terminal Server. Sympthoms were: 1. He phoned me with "'connecting' message just hangs forever". He's just a simple user so I can't expect detailed problem description. 2. Tried logging off/resetting session (which usually helps in these cases) - did not work. The session still hangs in the list with 'disconnected' status. 3. Tried killing all processes for that user - did not help. Session persists and refuses to get killed.
Solution was - connect as user (login with his credentials if you can reset his password or use some kind of remote assistance to see what happens on his computer) and see what happens in logon window. When connecting I clicked on RDP Client's 'details' button - and here it was, a error message that winlogon did something wrong, it was waiting for user to click on 'retry/ignore/etc' buttons and since it's the omnipotent winlogon it caused all that weird behavior.
p.s. I could not found any way to really force kill a session :(
We just had a similar issue with our Windows Server 2008 R2 Remote Desktop server. The user session showed "Active" when looking at RDS Manager, but did not have the associated session ID# or connected device showing (both were blank).
All of the tricks above did not resolve the issue. When connecting as the user in question, an error message came back stating that the Terminal Server was busy and to try again later or contact the administrator.
We wound up rebooting the server as well.
I had the same issue in Windows Server 2016. The user was not able to login.
So I tried the following steps to disconnect the orphaned session:
show active sessions and kill them
with the session id (7) from 1. I tried to kill this session with either reset session 7 (fyi: rwinsta is an alias for reset session)
it worked for one session, but the next time it just had no effect, so I opened the task manager and the user tab. There you find one expandable list assigned to every remote desktop user - one list had no user name in it and only showed 4 tasks running.
I tried the obvious one: Logging off the user. Without any effect.
trying to logoff the user
After Step / Try 4 even the last crashed session was killed and the user was able to login again
You can start a cmd, do a query session, check the id of the session to be killed and then do a reset session. For instance, if with query session you get that the session name rdp-tcp#1 is the one you want to kill, then you can execute reset session rdp-tcp#1 and get it killed.
I'd the same situation: a Windows Server 2008 R2 with Remote Desktop Services, RDP connection set up to log off users after the session is inactive or disconnected 3 hours, and still some sessions remained locked. I tried to log them off with both Remote Desktop Manager and qwinsta/quser, with no success.
Here's how I resolved it:
qwinsta
.winlogon.exe
for the hung session withquery process /ID:yourid
.taskkill /f /PID yourPID
.Way to go. I'd like otherwise to find a solution for this to not happen.
For those who prefer a UI way of doing this.
Download SysInternal suite. (https://docs.microsoft.com/en-us/sysinternals/downloads/sysinternals-suite)
Launch procexp64.exe in Admin mode
Click on "Users" and select the user in question. Click on "Properties"
qwinsta
.taskkill /FI "SESSION eq 1" /F
, assuming the session ID you wanted to end returned from qwinsta was 1.This worked on Server 2012 Version 6.2 Build 9200, I would expect it to work on all version of windows.