Prevent the same user from connecting while already connected in an RDP session.

Samet Takan 0 Reputation points
2025-03-05T06:49:52.42+00:00

Hello,

When I connect to the server using the Administrator account, if another person tries to connect with the same user, I receive the error message: "Your connection was lost because another connection was established to the remote computer." This forcibly logs me out of the session.

I want to prevent this behavior and ensure that when one person is already logged in, any subsequent connection attempts using the same user are blocked instead of terminating the active session.

How can I configure this?

Best regards.

Windows Server Remote and virtual desktops Session connectivity
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Mars Shan-MSFT 545 Reputation points Microsoft External Staff
    2025-03-06T01:09:36.2266667+00:00

    Hello,

    At this time, Windows does not include a built‑in option to completely block the new connection attempt while leaving the active session intact. However, here are some approaches you might consider:

    1. Disable Automatic Reconnection on the RDP Client

     • The RDP client (mstsc.exe) can be configured to not automatically reconnect if the connection is dropped.

     • With auto‑reconnect disabled, a new connection attempt by the same user won’t automatically take over the active session.

     • Note that this setting must be applied on the client side.

    1. Enforce “One Session per User” via Group Policy

     • Windows has a Group Policy setting: “Restrict Remote Desktop Services users to a single Remote Desktop Services session.”

     • You can find this under:

      Computer Configuration → Administrative Templates → Windows Components → Remote Desktop Services → Remote Desktop Session Host → Connections

     • Enabling this policy will ensure that only one session exists per user—and a new connection request will attempt to reattach to the active session rather than open a separate one.

     • However, if auto‑reconnection is enabled on the client side, the behavior of transferring the session may still occur.

    1. Implement a Custom Logon Check

     • If your goal is to entirely block a new login attempt when a session is already active (i.e., showing a clear “user already logged in” message without terminating the active session), a custom solution is required.

     • One approach is to create a logon script (for example, using PowerShell) that runs during login. This script can query active sessions (using tools like qwinsta) and, if a session is already active for that user, display a warning and immediately terminate the new connection.

     • Alternatively, consider third‑party session manager tools that enforce these kinds of connection rules.


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.