killing idle software licences on network

URGENT!!
I'm looking to kill software licenses in a network that have been idle for a certain time duration.
It should have an option of asking the user if he wants to kill the license or continue the session,
or
Kill the license automatically once the time elapses.

Any ideas or sample code???