我需要一些脚本来杀死我们服务器中的terminal会话。
基本上,一些用户通过terminal服务通过应用程序进行连接。 当他们closures应用程序时,通常会触发terminal服务的断开和closures。
在某些情况下,用户不是closures应用程序,而是closuresterminal服务。 由于应用程序仍在运行,这会使terminal会话挂起。
有没有脚本可以检测到挂起的terminal服务,包括正在运行的应用程序?
欣赏任何帮助。 谢谢。
请尝试下面提到的脚本:
REM @echo off REM This batch file will read a list of computers in 'computers.txt', query (qwinsta) REM the sessions that are currenlty disconnected, then pass them to REM reset them using (rwinsta). It might not be as graceful as a logoff REM but it works. REM Mike Stone REM 06/19/2008 For /F %%A in (computers.txt) do ( for /f "tokens=2" %%i in ('qwinsta /SERVER:%%A ^| find /i "disc"') do echo %%i | rwinsta %%i /SERVER:%%A /V )
使用terminal服务中的空闲超时和断开连接超时。
假设您在域中运行terminal服务(即使不是),也有一些GPO设置(或本地设置)来控制RDP会话。 似乎使用这些设置比重新发明轮子更受欢迎。 为什么编写和运行脚本,当您可以configuration组策略为您做的工作?