Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 would like to have an application restart automatically if a server crashes. It would have to restart without needing a user to login to an account. (run a program before login)

Based on my research I came up with a list of options

  1. Autologin to account + trigger application to start through windows service or task scheduler
  2. Wrap the application in a windows service
  3. Schedule application to be run when computer is powered on using windows task scheduler (Is this even possible?)
  4. Find a windows utility or free program that can do this

Are there any better ones? I just want the easiest solution to implement.

share|improve this question
Windows Service would be the best way to do this – Nixphoe Jun 7 '11 at 17:13

Not sure if it applies in 2008 but you can edit the local security policy to run a startup script. This runs when the system starts in 2003, XP and others. Also runs with elevated privileges

gpedit.msc and then computer configuration Windows Setting Scripts

share|improve this answer
And that would happen before the login screen? – chobo Jun 7 '11 at 17:08
Yes As it boots. Before a user has logged on – Dave M Jun 7 '11 at 18:45

There are two ways I would do this:

The Proper Way - run the app as a service.

The Quick And Dirty Way - run the app as a scheduled task. One of the scheduling options is for when the computer starts.

Don't expect either of those solutions to work well with an app that needs to be interactive.

share|improve this answer

In the past when I had to do this I set the server to auto-login with a script in the startup folder. The script would start the program I needed running and then lock the screen.

To lock the screen have this code in your script:

rundll32.exe user32.dll,LockWorkStation
share|improve this answer

You need to give the user in question (a properly configured one, mind you), logon as batch job rights. Then, have it run on boot up, that way you do not need an interactive logon off the bat.

share|improve this answer

Using Task Scheduler, create a Basic Task, and for the trigger select "When the computer starts".

This should work well, unless the application interacts with the desktop, which could be an issue.

You can configure advanced options too, such as to restart the app if it fails and so forth. Wrapping your .exe in a service, or creating a service, is probably overkill and unneeded.

share|improve this answer

Run it as a service. One of the advantages (besides starting at computer start) is that if it crashes, the Service Control Manager can be configured to start the service up again for you automatically.

share|improve this answer

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.