Open in the explorer

Start a program on connection

Démarrer un programme à la connexion

Type
User
GPO path
User Configuration › Policies › Administrative Templates › Windows Components › Remote Desktop Services › Remote Desktop Session Host › Remote Session Environment FR: Configuration utilisateur › Stratégies › Modèles d'administration › Composants Windows › Services Bureau à distance › Hôte de la session Bureau à distance › Environnement de session à distance
Supported on
At least Windows Server 2003 FR: Au minimum Windows Server 2003
ADMX file
TerminalServer.admx
Internal name
TerminalServer/TS_START_PROGRAM_1

Explanation

Configures Remote Desktop Services to run a specified program automatically upon connection.

You can use this setting to specify a program to run automatically when a user logs on to a remote computer.

By default, Remote Desktop Services sessions provide access to the full Windows desktop, unless otherwise specified with this setting, by the server administrator, or by the user in configuring the client connection. Enabling this setting overrides the "Start Program" settings set by the server administrator or user. The Start menu and Windows Desktop are not displayed, and when the user exits the program the session is automatically logged off.

To use this setting, in Program path and file name, type the fully qualified path and file name of the executable file to be run when the user logs on. If necessary, in Working Directory, type the fully qualified path to the starting directory for the program. If you leave Working Directory blank, the program runs with its default working directory. If the specified program path, file name, or working directory is not the name of a valid directory, the RD Session Host server connection fails with an error message.

If the status is set to Enabled, Remote Desktop Services sessions automatically run the specified program and use the specified Working Directory (or the program default directory, if Working Directory is not specified) as the working directory for the program.

If the status is set to Disabled or Not Configured, Remote Desktop Services sessions start with the full desktop, unless the server administrator or user specify otherwise. (See "Computer Configuration\Administrative Templates\System\Logon\Run these programs at user logon" setting.)

Note: This setting appears in both Computer Configuration and User Configuration. If both settings are configured, the Computer Configuration setting overrides.

French text from Windows 11 26H2

Configure les services Bureau à distance pour qu’ils exécutent automatiquement un programme spécifié lors de la connexion.

Vous pouvez utiliser ce paramètre pour spécifier un programme à exécuter automatiquement quand un utilisateur se connecte à un ordinateur distant.

Par défaut, les sessions de services Bureau à distance fournissent un accès à la totalité du Bureau Windows, sauf si l’administrateur du serveur ou l’utilisateur, lors de la configuration de la connexion client, spécifie le contraire à l’aide de ce paramètre. L’activation de ce paramètre annule les paramètres « Démarrer le programme » définis par l’administrateur du serveur ou l’utilisateur. Le menu Démarrer et le Bureau Windows ne sont pas affichés, et quand l’utilisateur quitte le programme, la session est automatiquement déconnectée.

Pour utiliser ce paramètre, dans Chemin d’accès au programme et nom du fichier, tapez le chemin d’accès et le nom de fichier complets du fichier à exécuter quand l’utilisateur ouvre une session. Si nécessaire, dans Répertoire de travail, entrez le chemin complet du répertoire de démarrage du programme. Si vous n’indiquez rien dans Répertoire de travail, le programme est exécuté à partir de son répertoire de travail par défaut. Si le répertoire de travail, le nom de fichier ou le chemin du programme spécifié n’est pas le nom d’un répertoire valide, la connexion du serveur Hôte de la session Bureau à distance échoue en affichant un message d’erreur.

Si vous activez ce paramètre, les sessions des services Bureau à distance exécutent automatiquement le programme spécifié et utilisent le répertoire de travail indiqué (ou, à défaut, le répertoire par défaut du programme).

Si vous désactivez ce paramètre ou ne le configurez pas, les sessions des services Bureau à distance démarrent avec l’intégralité du Bureau, sauf si l’administrateur du serveur ou l’utilisateur en décident autrement. (Voir le paramètre « Configuration ordinateur\Modèles d’administration\Système\Ouverture de session\Exécuter ces programmes à l’ouverture de session utilisateur ».)

Remarque : ce paramètre s’affiche à la fois dans Configuration de l’ordinateur et Configuration de l’utilisateur. Si les deux paramètres sont configurés, le paramètre Configuration de l’ordinateur est prioritaire.

Registry

HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
Value name
fInheritInitialProgram
StateValue written
Enablednot defined in the ADMX (see the options below)
Disablednot defined in the ADMX (see the options below)

PowerShell

PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.

The ADMX does not specify the value written when enabled; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled). The commands below use 1/0 as an assumption.

Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.

Enable

# Enable: TerminalServer/TS_START_PROGRAM_1
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'fInheritInitialProgram' -Value 1 -Type DWord  # assumed value (not defined in the ADMX)
# Program path and file name
Set-ItemProperty -Path $k -Name 'InitialProgram' -Value '<value>' -Type String
# Working Directory
Set-ItemProperty -Path $k -Name 'WorkDirectory' -Value '<value>' -Type String

Disable

# Disable: TerminalServer/TS_START_PROGRAM_1
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# The ADMX does not specify the value written; the GPO editor usually writes REG_DWORD 1 (enabled) / 0 (disabled)
Set-ItemProperty -Path $k -Name 'fInheritInitialProgram' -Value 0 -Type DWord  # assumed value (not defined in the ADMX)

Revert to "Not configured"

# Revert to "Not configured": TerminalServer/TS_START_PROGRAM_1
$k = 'HKCU:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services'
Remove-ItemProperty -Path $k -Name 'fInheritInitialProgram' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'InitialProgram' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'WorkDirectory' -ErrorAction SilentlyContinue

Options (2)

LabelControlRegistry valueREG typeConstraints / details
Program path and file nameChemin du programme et nom de fichierTS_PROGRAM_NAMEText boxtextInitialProgramREG_SZ
Required
Working DirectoryRépertoire de travailTS_WORKDIRText boxtextWorkDirectoryREG_SZ

Availability