7

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.

3

7 Answers 7

6

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.

3
  • And that would happen before the login screen?
    – chobo
    Jun 7, 2011 at 17:08
  • 1
    Yes As it boots. Before a user has logged on
    – Dave M
    Jun 7, 2011 at 18:45
  • I know this is a quite late for comment, but i'm using window 10 Home and it seem not working. Does anyone success?
    – simpsons3
    Mar 21, 2022 at 10:34
4

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.

0

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
0

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.

0

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.

0

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.

0

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .