I’ve got a particular program running on a Windows 2012 R2 server that seems to crash from time to time, removing the ability for users to switch TV channels on the floor of our business. Whenever this happens, I simply have to start the program on the server and functionality is restored.

I’d like to automate this process, so that the server can monitor the program itself, and restart it if it’s not running. The program does not run as a service.

Is there a way to configure the program to run as a service without a third party application? (I don’t want to expand the potential problem domain with yet another program)

I’ve thought about using a powershell script launched regularly by a scheduled task to check if the process is running and restart if not. Any advice on doing this or am I overlooking a simpler solution?

If I can get it running as a service then I could obviously use the failover conditions to relaunch the service if it crashes…

Thanks for your help.

10 Spice ups

You can create a simple task with a batch file that launches it every five minutes. In case it is already rnning, the batch terminates:

tasklist | findstr /i your.exe && goto end 
c:\path\to\your.exe 
:end
2 Spice ups

Scheduling a task that checks to see if the service (or exe) is running is a band-aid. Determining why something fails and then resolving that issue is the proper methodology

3 Spice ups

Should be able to create it as a service.

There are a few things you should find out first…

  1. Can the application be run as a service ?

  2. Can the application be started in the background or must the user always be logged in ?

  3. When you say “crash” what happens ?? Did a RDP session close and thus the application :crash" ?

1 Spice up

So this is exactly what I needed, however I am now running into the issue that my process has the same process name as some other programs running on the server. How can I get around this to be looking up the correct process?

What is that application ?

Could the main or initial problem be that the application could only be run once and you (or something else) are triggering it to start and causes the instances to stop each other ?

You cannot take for granted that all applications can run more then one instance, even in RDP modes etc.