This article is for those administrators that want to have only a single specific program run automatically when a user logs in to their RDS Server (Domain). When the user is done using that application and closes it, then the RDP Session logs that user out. Step 1 below works fine on it’s own in 2008 and 2012. However, step 2 is required for Server 2016.

1. For testing, we are using Notepad.exe. Login to the RDS Server as an Administrator and then open AD Users and Computers under Administrative Tools in Control Panel. Double-click the user for which you would like to run your application and under the “Environment” Tab, enter the following (Make sure the user is a Member Of “Remote Desktop Users”):

2. Again, for Server 2016, we will need to add 2 Registry Settings for this to work. If using 2012 or prior, Step 1 should be sufficient. Run “Regedit” on the Server and add the following Registry Keys (Make sure to backup the Registry before making any changes as a Best Practice):

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
Name: fQueryUserConfigFromDC
Type: Reg_DWORD
Value: 1 (Decimal)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\<Winstation Name>\
Name: fQueryUserConfigFromDC
Type: Reg_DWORD
Value: 1 (Decimal)

That’s it. Reboot your server and then login via RDP with the user in Step 1. You should see the RDP session only open Notepad.exe, and when it’s closed, the session should logoff.

Alternatively, you can use Group Policy:

1. In Group Policy Editor, navigate to:

User Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Remote Session Environment

Add the following 2 settings:

a. Start a Program on Connection – Enabled, and enter the path to your application.

b. Always Show Desktop on Connection – Disabled

You may need to run gpupdate /force in an elevated command prompt and/or reboot the Server.