[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2987
  • Last Modified:

Script to terminate disconnected windows terminal sessions.

We are facing RDP issues when ever connecting to few win 2k3 servers .

Getting too many users logged into server.

Normally we use tsadmin and logoff all the disconnected sessions or use Windows Command line:

query user logoff session id

Is there any script where we can give inputs of few servers , which can monitor regularly and kill/logoff all the disconnected sessions .

The script can reduce our manual job. Even kindly let me know if we have any group policy to terminate disconnected sessions at a regular time interval.
  • 2
  • 2
3 Solutions
AhmedAliShaikAuthor Commented:
Even we have the below command to get the current terminal sessions and kill the disconnected sessions.

Can we write some script using the commands identify disconnected sessions and kill them.
Please suggest.

Qwinsta sessionid /server:servername
rwinsta sessionid /server:servername
Brad BouchardInformation Systems Security OfficerCommented:
This is super easy, just configure session limits and users who go past them even if they are disconnected or inactive will be logged off.

This shows you how:  http://technet.microsoft.com/en-us/library/cc779468(v=ws.10).aspx
VishalnarseSystem Wintel Administrator L2Commented:
AhmedAliShaikAuthor Commented:
Thanks All.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now