This is a complicated question. Task Scheduler can be used to start a task every five minutes, but cannot be set to run that task as the currently logged in user; you can tell it to run as a specific user, only when that user is logged in, but if someone else logs in they won't get that task. If I was going to do this, I'd write a separate watchdog app, either that started when the user logged in and just woke up and checked every five minutes if the main task was still running, or else as a task in Local Service context that was started every five minutes by the scheduler and did the check for the currently logged in users. (Remember that Windows can have multiple users logged in at once, on different desktops.) I believe this would require a touch of custom programming in either case, and so may fall outside the scope of Server Fault.