大网数据广告活动
远程桌面与会话

How to disable warning message for idle remote desktop sessions

· 52CE 我爱测

Provides the method to disable warning message for idle remote desktop sessions by using PowerShell.

Applies to:   Windows Servers

When a remote desktop session idle session limit is exceeded, a warning message is displayed and the session is disconnected after two minutes. If you want the session to be disconnected immediately and without a warning message, set the EnableTimeoutWarning property of the Win32_TSSessionSettings WMI class to 0 by using the following PowerShell cmdlet from an elevated PowerShell prompt (as an administrator):

Note: This change takes effect only after active sessions are disconnected and reconnected.

Set-WmiInstance -Path "\\localhost\root\CIMV2\TerminalServices:Win32_TSSessionSetting.TerminalName='RDP-Tcp'" -Argument @{EnableTimeoutWarning=0}

You can determine the idle session limit by using the following PowerShell cmdlet:

Get-WmiObject -ComputerName localhost -Namespace root\CIMV2\TerminalServices -Class Win32_TSSessionSetting  -filter "TerminalName='RDP-Tcp'" | select IdleSessionLimit

Note:

  • The EnableTimeoutWarning property has been deprecated for third-party protocol providers starting from Windows 10, version 2004 and Windows Server, version 2004. Contact the protocol provider for help to enable or disable the warning message.
  • If a third-party protocol provider is used, replace "RDP-Tcp" with the relevant protocol name for the provider.
  • If you're running the cmdlet remotely, make sure the server's firewall allows WMI access and replace "localhost" with the server's name.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
- Supported versions of Windows Server · Source date 02/12/2026
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。