0

i am creating exe shortcut on Windows startup folder while installing application. It was automatically starts on Windows start and restart.

I want check on every 5 mins whether the exe running or not. If it's not running i want to start the exe like as current logged in user click.

I need to create a task scheduler for it. Let me know how to achieve it. If any samples

Hisanth
  • 1
  • 1
  • Questions seeking installation, configuration or diagnostic help must include the desired end state, the specific problem or error, sufficient information about the configuration and environment to reproduce it, and attempted solutions. Questions without a clear problem statement are not useful to other readers and are unlikely to get good answers. we will assist you, when you show us what you tried and what research you have done. see also [ask] – djdomi Jul 26 '23 at 17:42

1 Answers1

0

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.

tsc_chazz
  • 905
  • 3
  • 14