Previously we wrote about how to terminate the existing connections using “tsadmin” and “session” command . We know the command and syntax are difficult to remember. that is why i just converted this commands to a Batch file. Copy the scripts and save it as a .bat file. while executing the batch file , it will prompt for the Ip address / hostname, User name, password of the server which you want to connect. Batch file will connect to the server with the provided loin credentials and display the list of current session. Then screen will prompt for the session id.script will reset the session you selected and start a rdp connection to the same server. Expecting your comments
@echo off Title "RDP Session Terminator by www.binbert.com" cls echo. echo. set /p IP= Server IP : cls echo. echo. set /p username= User Name [administrator] : cls echo. echo. set /p password= Password for %username% : cls echo. echo. net use \\%IP% /user:%username% %password% qwinsta /server:%IP% echo. set /p sessionid= Type ID which you want to kill : rwinsta /server:%IP% %sessionid% mstsc /v %IP% pause