Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an exe, that starts when Windows Server 2008 SP2 is booting. It runs all the time and performs an important task (fetching mail for exchange). With the help of the Windows Task Scheduler I want to check if this process is still running. What trigger do I choose? Or might there be some workaround with a batch program?

share|improve this question

One option may be to have it run on an interval, perhaps every 15 minutes, and on the Settings tab, configure "If the task is already running" for "Do not start a new instance". That way you can ensure it would be no longer than 15 minutes if it stops running.

share|improve this answer
yes, thats a good solution. one problem is though that the exe is started via a batch script to set up some logfiles and the batch file itself is no running process. before i tried to kill the process and starting it again within the same batch script, ensuring the process is not run twice, but this didnt work out 100% of the time. – Hans Jan 3 '12 at 13:36
Would it not be an option to have the script run in a loop? Seems like doing that would obviate the need for hooking into some kind of event or having an external process check on it. – Greg Askew Jan 3 '12 at 14:26

This is going to have to be done with scripting or programming. For example, write a Powershell script that checks the list of running processes every few minutes, and then performs some action if process x is not on the list.

share|improve this answer
If you're willing to code in C (or any other language that can access the Windows API) you don't need to poll. Once you've found the process in question, do a wait on the process handle; the wait will complete when/if the process exits. – Harry Johnston Jan 5 '12 at 21:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.