Start a program on connection: registry value InitialProgram and 1 more (HKLM Terminal Services)ComputerHKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
- Policy ID
- TS_START_PROGRAM_2
- Scope
- Computer Configuration
- Supported on
- At least Windows Server 2003
- Source
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (version 1.0)
- Category
- Windows Components › Remote Desktop Services › Remote Desktop Session Host › Remote Session Environment
Registry
InitialProgram
REG_SZComputer- Enabled value
- Depends on the option value
- Element
- Program path and file name
- Value type
- REG_SZ
- Required
- true
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services] ; Value names and types follow the ADMX. Replace <enter value> below with your own data "InitialProgram"="<enter value>"
CMD
:: Value names and types follow the ADMX. Replace <enter value> below with your own data reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "InitialProgram" /t REG_SZ /d "<enter value>" /f
PowerShell
# Value names and types follow the ADMX. Replace <enter value> below with your own data New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Force | Out-Null New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'InitialProgram' -PropertyType String -Value '<enter value>' -Force | Out-Null
WorkDirectory
REG_SZComputer- Enabled value
- Depends on the option value
- Element
- Working Directory
- Value type
- REG_SZ
Apply with .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services] ; Value names and types follow the ADMX. Replace <enter value> below with your own data "WorkDirectory"="<enter value>"
CMD
:: Value names and types follow the ADMX. Replace <enter value> below with your own data reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "WorkDirectory" /t REG_SZ /d "<enter value>" /f
PowerShell
# Value names and types follow the ADMX. Replace <enter value> below with your own data New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Force | Out-Null New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'WorkDirectory' -PropertyType String -Value '<enter value>' -Force | Out-Null