Solved

Detecting If A Terminal Services Session Is Left Disconnected

Posted on 2010-11-16
3
617 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:Porka
3 Comments
 
LVL 3

Accepted Solution

by:
RussPitcher earned 250 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 250 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:Porka
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
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…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now