Kill Idle Process

  • Thread starter Thread starter Jim G
  • Start date Start date
J

Jim G

Hi,

We have a limited number of licenses to some software we have
installed on our users desktops. The problem is that sometimes the
users open up the application and then don't use it all day. This
prevents others from being able to use the application because we run
out of licenses.

I'm thinking that we want to create a windows service using VB.Net
that we will run on everyone's machine and have it monitor this
application to see if it is idle for too long. If it is idle for too
long, we will then kill it and pop up a message to the users letting
them know what we did. Does anyone have any ideas? Any sample code?

Thanks!
 
Hi, this isn't a code solution, but, have you even looked into Terminal
services? You can disconnect idle users automatically. I don't know what the
licensing is so you will have to look into it. Just a suggestion.
 
So you want to have an application that

a) scans all the running processes
b) for an identified subset of those, determine how long each has been
"idle"
c) stop those whose idle time exceeds a threshold and
d) inform the user you have done so with a friendly message.

A pretty puzzle, and I hope some guru or other can help you.

I found some interesting stuff in System.Diagnostics.Process. If I am
reading that correctly, you can find the processes and their names (a).
You can find their state (e.g. idle in ProcessPriorityClass), but I don't
see an idle time in that class.

If you had a thread that checked the state every few seconds... but the
problem I see is that it may have gone un-idle and back to idle in the
interim. I suppose you could check resource usage -- TotalProcessorTime --
and if it is unchanged for the time period...

In any case,

Good Luck!
 
On Fri, 19 Dec 2003 07:34:40 -0600, Otuse net wrote:


Perhaps there are some classes in WMI that would provide a means of
determining the apps idle state. Perhaps the WMI could be polled at
regular intervals and if the process's state had not changed, then take
action.
 
Back
Top