[Windows Server 2022] RDP, alternate-shell option is randomly ignored if user has a disconnected session on the server

Anonymous
2024-05-29T06:17:10+00:00
  • OS: Windows Server 2022

I created two rdp files to launch two differents apps within a RDP session on the same server and the same user,

One file (File 1) has the option "alternate-shell" set to "notepad.exe"

The other file (File 2) has the option "alternate-shell" set to "mspaint.exe"

I launch File 1, the session is opens correctly with notepad.exe loaded in it

Now I disconnect the session (without resetting the session, it remains visible on the server task manager )

When launching File 2, I expect to start a new session with mspaint, but randomly the disconnected session+notepad (opened with File 1) gets reconnected and no new session opens.

I don't have any policy and registry value preventing the user to open multiple sessions to this server, this behaviour seems random and only reproduced with Windows Server 2022

In the event viewer I can see a new session is opened but immediately closed, and the first one is reconnected, no matter what I 've set for "alternate-shell"

Image 1: the RDP files

Image 2 : the disconnected session with notepad

Image 3 : try to launch new RDP session with mspaint

Windows Server Remote and virtual desktops Remote desktop services and terminal services

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-05-29T16:23:01+00:00

    Hello,

    The Remote Desktop Protocol will usually try to restore an existing session instead of creating a new one, especially when the username and server address are the same. This is to save resources and provide a consistent user experience.

    In order to open multiple sessions as the same user on the same server, please check the Group Policy settings on the server again. Navigate to Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Connections. Then, disable the policy in the figure below. After confirmation, use the “gpupdate /force” command to force a refresh.

    Image

    Note: Serious problems might occur if you modify the Group Policy incorrectly. Therefore, make sure that you follow these steps carefully. For further protection, back up the Group Policy before you modify it. For more information about how to back up and restore the group policy, refer to Backup and restore Group Policy in Windows | Microsoft Learn

    If you have any confusion about this issue in the future, please let us know.

    We value your feedback, click Yes or No to help us improve the support experience.

    Best regards,

    Jacen Wang

    0 comments No comments
  2. Anonymous
    2024-05-30T06:37:24+00:00

    Hello, I have already done this without any effect, randomly the first session is reconnected

    I also tried to add "disableconnectionsharing:i:1" is the rdp files, does not change anything

    Here's the registry configuration: https://pastebin.com/BzfzexQr

    0 comments No comments