How to remove "Remote desktop disconnected" window and close mstsc.exe

1.6k views Asked by At

I'm trying to manage user's RDP session at Windows Server 2003. I have one Windows host. This host runs several user sessions.

c:>qwinsta

SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
>console           Administrator           0   Active  wdcon
rdp-tcp                                    65536  Listen  rdpwd
rdp-tcp#1         test1                    1   Active  rdpwd
rdp-tcp#2         test2                    2   Active  rdpwd

Sometimes I need to close user's session and open it from the scratch.

RWinsta %sessionID% command works fine - user session is closed.

but I still have mstsc.exe process running and an opened window with the information "the remote session was disconnected because your session was logged off at the remote computer"

How could I close not only user session but mstsc process also? Thank you.

1

There are 1 answers

2
prudviraj On

Try below code and check if it works :

taskkill /PID /F

Try more options according to your requirement ,

Try taskkill /?