Définir le délai d’expiration des sessions de services Bureau à distance actives : valeur de Registre MaxConnectionTime (HKLM Terminal Services)OrdinateurHKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services

ID de stratégie
TS_SESSIONS_Limits_2
Étendue
Configuration ordinateur
Pris en charge sur
Au minimum Windows Server 2003 ou Windows XP Professionnel
Source
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (version 1.0)
Catégorie
Composants Windows › Services Bureau à distance › Hôte de la session Bureau à distance › Délais d'expiration des sessions

Registre

MaxConnectionTime

REG_DWORDOrdinateur
Valeur si activée
Dépend de la valeur de l'option
Élément
Limite de session active :
Options
EntréeValeur stockée
Jamais0
1 minute60000
5 minutes300000
10 minutes600000
15 minutes900000
30 minutes1800000
1 heure3600000
2 heures7200000
3 heures10800000
6 heures21600000
8 heures28800000
12 heures43200000
16 heures57600000
18 heures64800000
1 jour86400000
2 jours172800000
3 jours259200000
4 jours345600000
5 jours432000000
Appliquer avec .reg · CMD · PowerShell
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services]

; Options (en utiliser une seule)
; Jamais
"MaxConnectionTime"=dword:00000000
; 1 minute
"MaxConnectionTime"=dword:0000ea60
; 5 minutes
"MaxConnectionTime"=dword:000493e0
; 10 minutes
"MaxConnectionTime"=dword:000927c0
; 15 minutes
"MaxConnectionTime"=dword:000dbba0
; 30 minutes
"MaxConnectionTime"=dword:001b7740
; 1 heure
"MaxConnectionTime"=dword:0036ee80
; 2 heures
"MaxConnectionTime"=dword:006ddd00
; 3 heures
"MaxConnectionTime"=dword:00a4cb80
; 6 heures
"MaxConnectionTime"=dword:01499700
; 8 heures
"MaxConnectionTime"=dword:01b77400
; 12 heures
"MaxConnectionTime"=dword:02932e00
; 16 heures
"MaxConnectionTime"=dword:036ee800
; 18 heures
"MaxConnectionTime"=dword:03dcc500
; 1 jour
"MaxConnectionTime"=dword:05265c00
; 2 jours
"MaxConnectionTime"=dword:0a4cb800
; 3 jours
"MaxConnectionTime"=dword:0f731400
; 4 jours
"MaxConnectionTime"=dword:14997000
; 5 jours
"MaxConnectionTime"=dword:19bfcc00
CMD
:: Options (en utiliser une seule)

:: Jamais
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 0 /f
:: 1 minute
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 60000 /f
:: 5 minutes
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 300000 /f
:: 10 minutes
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 600000 /f
:: 15 minutes
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 900000 /f
:: 30 minutes
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 1800000 /f
:: 1 heure
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 3600000 /f
:: 2 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 7200000 /f
:: 3 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 10800000 /f
:: 6 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 21600000 /f
:: 8 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 28800000 /f
:: 12 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 43200000 /f
:: 16 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 57600000 /f
:: 18 heures
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 64800000 /f
:: 1 jour
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 86400000 /f
:: 2 jours
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 172800000 /f
:: 3 jours
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 259200000 /f
:: 4 jours
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 345600000 /f
:: 5 jours
reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 432000000 /f
PowerShell
# Commun : créer la clé
New-Item -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Force | Out-Null

# Options (en utiliser une seule)
# Jamais
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 0 -Force | Out-Null
# 1 minute
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 60000 -Force | Out-Null
# 5 minutes
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 300000 -Force | Out-Null
# 10 minutes
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 600000 -Force | Out-Null
# 15 minutes
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 900000 -Force | Out-Null
# 30 minutes
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 1800000 -Force | Out-Null
# 1 heure
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 3600000 -Force | Out-Null
# 2 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 7200000 -Force | Out-Null
# 3 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 10800000 -Force | Out-Null
# 6 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 21600000 -Force | Out-Null
# 8 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 28800000 -Force | Out-Null
# 12 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 43200000 -Force | Out-Null
# 16 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 57600000 -Force | Out-Null
# 18 heures
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 64800000 -Force | Out-Null
# 1 jour
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 86400000 -Force | Out-Null
# 2 jours
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 172800000 -Force | Out-Null
# 3 jours
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 259200000 -Force | Out-Null
# 4 jours
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 345600000 -Force | Out-Null
# 5 jours
New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 432000000 -Force | Out-Null