[WINDOWS SERVER 2019] Start a program with the remote desktop

Fabio Bernini 31 Reputation points
2020-11-16T21:03:14.647+00:00

Goodmorning everyone,
I installed Windows Server 2019 on a server, before this the last server I had installed was with Windows Server 2008. My problem is to start a program automatically in a Remote Desktop session so that the user can only use that program and do not access the rest of the computer, when the program is closed, the Remote Desktop session must also be closed. I tried to do as it was up to at least Windows Server 2008 that is to set the startup program from the "Environment" section of the user which worked fine. Now in Windows Server 2019 I have seen that there is the possibility to set a program in the environment, but in fact it does not work or the program does not start and the user can access everything.
Is there anyone who can help me understand what is the best practice to solve my problem?
Thank you all.

Windows for business | Windows Client for IT Pros | User experience | Remote desktop services and terminal services
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Jenny Yan-MSFT 9,356 Reputation points
    2020-11-17T06:09:41.053+00:00

    Hi,
    1.RDS provides function of publishing the program as a RemoteApp for users to utilize application directly without logging into the remote session of server.
    Create a Remote Desktop Services collection for desktops and apps to run
    https://learn.microsoft.com/en-us/windows-server/remote/remote-desktop-services/rds-create-collection#publish-remoteapp-programs

    2.Per my knowledge, RD Session Host Role Service is required to use the start a program on connection feature. Did you installed RDSH role for the server?

    3.The most widely used method to disable Remote Desktop Access but allow RemoteAPPs is the one shared in below thread:

    User Configuration > Policies > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Remote Session Environment > Start a program on connection
    Put c:\windows\system32\logoff.exe in the Program path.
    Add this to user GPOs but not sysadmin GPOs.

    https://social.technet.microsoft.com/Forums/lync/en-US/5d17f131-c6d1-49dd-b0b7-83c03c3fedbb/how-to-disable-remote-desktop-access-but-allow-remoteapps-to-run?forum=winserverTS


    Hope this helps and please help to accept as Answer if the response is useful.

    Thanks,
    Jenny


  2. Fabio Bernini 31 Reputation points
    2020-11-19T20:54:22.267+00:00

    Hello, yes I installed Remote Desktop Host services.
    I tried but I get some errors and i was in doubt: should the RDP host be a domain controller or belong to a domain?


  3. Jenny Yan-MSFT 9,356 Reputation points
    2020-11-23T06:00:24.297+00:00

    Hi,
    It seems you are trying to create RDS collection and publish remote applications via RD web.

    But if you are new to remote desktop service, it is suggested to deploy RDS via GUI with following screenshots and get better understanding for each roles related to RDS.
    https://nedimmehic.org/2017/01/21/deploying-remote-desktop-services-2016-step-by-step/

    For the information you posted, it seemed that you did not specify the FQDN of collection or server of RDCB and RDSH. Moreover, command"New-RDVirtualDesktopDeployment" is used to install the role services of VDI instead of RD session host.
    https://learn.microsoft.com/en-us/powershell/module/remotedesktop/new-rdvirtualdesktopdeployment?view=win10-ps

    Last but not least, here are step by step guidance on how to deploy RDS with powershell command:

    1. Step by Step instructions for installing RDS Session Deployment using PowerShell in Windows Server 2012 R2
      https://techcommunity.microsoft.com/t5/ask-the-performance-team/step-by-step-instructions-for-installing-rds-session-deployment/ba-p/375569
    2. Deploy Windows 2016 RDS with PowerShell
      https://www.aventistech.com/Deploy-Windows-2016-RDS-with-PowerShell
      Please note: Information posted in the given link is hosted by a third party. Microsoft does not guarantee the accuracy and effectiveness of information.

    ----------

    Hope this helps and please help to accept as Answer if the response is useful.

    Thanks,
    Jenny

    0 comments No comments

  4. Fabio Bernini 31 Reputation points
    2020-11-20T09:17:58.217+00:00

    Hi Jenny,
    very well, because I need the server not to be a domain controller and will not belong to a domain. Then there's something that escapes me because I've read the documents of the links you sent me but trying to get errors. Obviously there's something I didn't understand.
    I tried this from Power Shell, I hope I translated well because it is in Italian:

    PS C:\Users\Administrator> New-RDSessionCollection -PersonalUnmanaged
    
    Cmdlet New-RDSessionCollection in position 1 of the command pipeline
    Specify values ​​for the following parameters:
    CollectionName: test
    SessionHost[0]: 0
    SessionHost[1]:
    NOTICE: The specified fully qualified domain name (FQDN), 0, is not valid.
    New-RDSessionCollection : Unable to create session set.
    In line:1 car:1
    + New-RDSessionCollection -PersonalUnmanaged
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDSessionCollection
    

    I think I don't know and understand what goes into "SessionHost". I tried to put server hostname (Server2019) but I receive another error:

    Cmdlet New-RDSessionCollection in position 1 of the command pipeline
    Specify values ​​for the following parameters:
    CollectionName: test
    SessionHost[0]: server2019.workgroup
    SessionHost[1]:
    New-RDSessionCollection : There is no Remote Desktop Services deployment on Server2019. This operation
    it can only be run after you have created a distribution. For information on creating a distribution,
    execute the command "Get-Help New-RDVirtualDesktopDeployment" o "Get-Help New-RDSessionDeployment".
    In line:1 car:1
    + New-RDSessionCollection -PersonalUnmanaged
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDSessionCollection
    

    Then I tried how it is written, others errors:

    PS C:\Users\Administrator> New-RDVirtualDesktopDeployment
    
    Cmdlet New-RDVirtualDesktopDeployment in position 1 of the command pipeline
    Specify values ​​for the following parameters:
    ConnectionBroker: Server2019
    VirtualizationHost[0]: server2019.workgroup
    VirtualizationHost[1]:
    New-RDVirtualDesktopDeployment : Failed to validate "RD Connection Broker" parameter.
    Server2019 No valid fully qualified domain name (FQDN) specified for the server.
    In riga:1 car:1
    + New-RDVirtualDesktopDeployment
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDVirtualDesktopDeployment
    
    
    PS C:\Users\Administrator> New-RDVirtualDesktopDeployment
    
    Cmdlet New-RDVirtualDesktopDeployment in position 1 of the command pipeline
    Specify values ​​for the following parameters:ConnectionBroker: Server2019
    VirtualizationHost[0]: server2019
    VirtualizationHost[1]:
    New-RDVirtualDesktopDeployment : Failed to validate "RD Connection Broker" parameter.
    Server2019 No valid fully qualified domain name (FQDN) specified for the server.
    In line:1 car:1
    + New-RDVirtualDesktopDeployment
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
        + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-RDVirtualDesktopDeployment
    
    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.