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.

  • 4
    Windows Service would be the best way to do this – Nixphoe Jun 7 '11 at 17:13

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.


You can edit the local security policy to run a startup script. This runs when the system starts in 2003, 2008, XP and others. Also runs with elevated privileges

Run gpedit.msc and then go to Computer Configuration > Windows Settings > Scripts

There you will see Startup and Shutdown.

  • 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

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

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.


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.


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.


use Hstart application for your purpose. check this out http://www.ntwind.com/software/hstart.html

  • 1
    More detail on why this is a solution would improve your answer – Dave M Sep 15 '17 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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