設定使用中遠端桌面服務工作階段的時間限制 的登錄值 MaxConnectionTime (HKLM Terminal Services)電腦HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services
- 原則 ID
- TS_SESSIONS_Limits_2
- 適用範圍
- 電腦設定
- 支援的作業系統
- 至少需要 Windows Server 2003 作業系統或 Windows XP Professional
- 來源
- Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
- 類別
- Windows 元件 › 遠端桌面服務 › 遠端桌面工作階段主機 › 工作階段時間限制
登錄
MaxConnectionTime
REG_DWORD電腦- 啟用時的值
- 取決於選項值
- 元素
- 使用中工作階段限制:
| 項目 | 儲存的值 |
|---|---|
| 永不 | 0 |
| 1 分鐘 | 60000 |
| 5 分鐘 | 300000 |
| 10 分鐘 | 600000 |
| 15 分鐘 | 900000 |
| 30 分鐘 | 1800000 |
| 1 小時 | 3600000 |
| 2 小時 | 7200000 |
| 3 小時 | 10800000 |
| 6 小時 | 21600000 |
| 8 小時 | 28800000 |
| 12 小時 | 43200000 |
| 16 小時 | 57600000 |
| 18 小時 | 64800000 |
| 1 天 | 86400000 |
| 2 天 | 172800000 |
| 3 天 | 259200000 |
| 4 天 | 345600000 |
| 5 天 | 432000000 |
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services] ; 選項 (只使用其中一個) ; 永不 "MaxConnectionTime"=dword:00000000 ; 1 分鐘 "MaxConnectionTime"=dword:0000ea60 ; 5 分鐘 "MaxConnectionTime"=dword:000493e0 ; 10 分鐘 "MaxConnectionTime"=dword:000927c0 ; 15 分鐘 "MaxConnectionTime"=dword:000dbba0 ; 30 分鐘 "MaxConnectionTime"=dword:001b7740 ; 1 小時 "MaxConnectionTime"=dword:0036ee80 ; 2 小時 "MaxConnectionTime"=dword:006ddd00 ; 3 小時 "MaxConnectionTime"=dword:00a4cb80 ; 6 小時 "MaxConnectionTime"=dword:01499700 ; 8 小時 "MaxConnectionTime"=dword:01b77400 ; 12 小時 "MaxConnectionTime"=dword:02932e00 ; 16 小時 "MaxConnectionTime"=dword:036ee800 ; 18 小時 "MaxConnectionTime"=dword:03dcc500 ; 1 天 "MaxConnectionTime"=dword:05265c00 ; 2 天 "MaxConnectionTime"=dword:0a4cb800 ; 3 天 "MaxConnectionTime"=dword:0f731400 ; 4 天 "MaxConnectionTime"=dword:14997000 ; 5 天 "MaxConnectionTime"=dword:19bfcc00
CMD
:: 選項 (只使用其中一個) :: 永不 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 0 /f :: 1 分鐘 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 60000 /f :: 5 分鐘 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 300000 /f :: 10 分鐘 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 600000 /f :: 15 分鐘 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 900000 /f :: 30 分鐘 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 1800000 /f :: 1 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 3600000 /f :: 2 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 7200000 /f :: 3 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 10800000 /f :: 6 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 21600000 /f :: 8 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 28800000 /f :: 12 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 43200000 /f :: 16 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 57600000 /f :: 18 小時 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 64800000 /f :: 1 天 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 86400000 /f :: 2 天 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 172800000 /f :: 3 天 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 259200000 /f :: 4 天 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 345600000 /f :: 5 天 reg add "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v "MaxConnectionTime" /t REG_DWORD /d 432000000 /f
PowerShell
# 共通: 建立機碼 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 'MaxConnectionTime' -PropertyType DWord -Value 0 -Force | Out-Null # 1 分鐘 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 60000 -Force | Out-Null # 5 分鐘 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 300000 -Force | Out-Null # 10 分鐘 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 600000 -Force | Out-Null # 15 分鐘 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 900000 -Force | Out-Null # 30 分鐘 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 1800000 -Force | Out-Null # 1 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 3600000 -Force | Out-Null # 2 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 7200000 -Force | Out-Null # 3 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 10800000 -Force | Out-Null # 6 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 21600000 -Force | Out-Null # 8 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 28800000 -Force | Out-Null # 12 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 43200000 -Force | Out-Null # 16 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 57600000 -Force | Out-Null # 18 小時 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 64800000 -Force | Out-Null # 1 天 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 86400000 -Force | Out-Null # 2 天 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 172800000 -Force | Out-Null # 3 天 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 259200000 -Force | Out-Null # 4 天 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 345600000 -Force | Out-Null # 5 天 New-ItemProperty -Path 'HKLM:\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services' -Name 'MaxConnectionTime' -PropertyType DWord -Value 432000000 -Force | Out-Null