Jun 8 2011
Terminal Services Reset Script – Disconnected Sessions

Here’s what I found online:
It is a batch file. Now it would be helpful if it could also read in sessions that are idle for an hour and reset those as well.

The other option is to set
Set a time-out limit on idle and disconnected sessions and reset them
when the time-out is reached. You can do this in TS Configuration (or
with a Group Policy in 2003)

=====================================================
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
)

Written by

View all posts by:

Categories: Uncategorized