Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Detecting If A Terminal Services Session Is Left Disconnected

Posted on 2010-11-16
3
Medium Priority
?
625 Views
Last Modified: 2012-05-10
Hello experts

Im looking for a method to detect when a terminal server session has been left disconnected for x minutes and to perform an action. Bascially we need to keep track of disconnected sessions and then force them closed (Closing a session is easy enough through the settings for the terminal server). My ultimate goal is to basically deny people access to the server if they leave a session disconnected x times. Server we are using is 2003 r2 server. Has anybody done anything like this before ?
0
Comment
Question by:Jarrod
3 Comments
 
LVL 3

Accepted Solution

by:
RussPitcher earned 1000 total points
ID: 34144614
It should be fairly simple to use the 'query session' command with a bit of PowerShell or VBscript to parse the output.  Off the top of my head if you spot a user with a disconnected session you could save a text file named with their username and write a '1' to it.  If the file already exists then just increment the number.  You could also issue a 'logoff session xx' command to boot them off at the same time.  After the number gets to the level of your choice then send an e-mail to the admin to block them, or the user to nag them.  You could also have a 'reset' period - if the file hasn't been updated for Y days then it gets deleted and the slate is wiped clean - if you are feeling generous :)
0
 
LVL 8

Assisted Solution

by:GundogTrainer
GundogTrainer earned 1000 total points
ID: 34145611
There is a good starting script on EE already to kill disconnected sessions:

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_21183183.html?qid=21183183

Just looking at how it could be adapted to meet your requirements.
0
 
LVL 6

Author Comment

by:Jarrod
ID: 35004569
Sorry for delay guys. I ended up modifying gundogtrainers vbs link to do the job but used russpitchers idea of a text file which a number that increments so I split to the points based on that. Thanks for all the help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
How to install and configure Citrix XenApp 6.5 - Part 1. In this video tutorial we have explained step by step installation of Citrix XenApp 6.5 Server on Windows Server 2008 R2 is explained in this video. We have explained the difference between…
Integration Management Part 2

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question