Skip to content

How to disconnect RDP session remotely?

It is quite possible that you want to make a remote desktop connection to your server but was not able to because of maximum RDP connections reached. In this case you can make use of below method to identify the currently connected RDP users and disconnect/logoff any user (Possibly the session which shows as Disc).

1) Run below command pn command prompt from your local machine to check currently connected users to your server.

C:\Users\User>qwinsta /server:servername

SESSIONNAME USERNAME ID STATE TYPE DEVICE
services                                          0    Disc
console                                          1     Conn
v6958            30   Disc
rdp-tcp#1             v3357             32    Active    rdpwd
rdp-tcp                                         65536    Listen

2) Run below query to disconnect user v3357 with session id 32
C:\Users\user>rwinsta 32 /server:servername

3) Run command in step 1 again to verify that the session id 32 is now gone and you will be able to make RDP connection now.

C:\Users\user>qwinsta /server:servername

SESSIONNAME USERNAME ID STATE TYPE DEVICE
services                                           0   Disc
console                                            1   Conn
v6958             30  Disc
rdp-tcp                                            65536   Listen