Save this script on batch file, update server list, and run.
1
2echo off
3cls
4echo computerName1 > computers.txt
5echo computerName2 > computers.txt
6echo computerName3 > computers.txt
7echo computerName4 > computers.txt
8FOR /F %%A IN (computers.txt) DO (
9
10 echo ------------------------------------------
11 echo Check server : %%A
12 echo.
13 qwinsta /server:%%A
14 echo.
15 FOR /f "tokens=2" %%i IN ('qwinsta /SERVER:%%A ^| find /i "disc"') DO (
16 ECHO %%i | rwinsta %%i /SERVER:%%A /V
17 )
18 echo.
19)
20
21pause
22exit
Source : http://serverfault.com/questions/211043/script-to-kill-terminal-sessions
Comments