Set up Recovery Actions to Take Place When a Service Fails
Solution 1:
If your services are stopping because of an error, that is logged by windows then yes, you need to tick 'Enable Actions For Stops With Errors', otherwise it will not work.
If you do not have this ticked, then it will only restart services that have stopped for legitimate or unknown reasons.
Solution 2:
The "Enable actions for stops with errors" checkbox was introduced with Windows Vista and Windows Server 2008, providing a single, embarrassing line of documentation:
Select Enable actions for stops with errors in order to trigger the recovery actions that the service stopped with an error.
The SC.exe program was also updated to provide a new command: failureflag
. The documentation shows a bad example and doesn't really apply to Windows Server 2003, but tells us that the command:
Specifies whether recovery actions will be triggered when a service stops as the result of an error.
So, the checkbox and sc failureflag
are used to set the same flag.
Let's type sc failureflag
in the command prompt, we finally get a quite decent description:
Changes the failure actions flag setting of a service. If this setting is 0 (default), the Service Control Manager (SCM) enables configured failure actions on the service only if the service process terminates with the service in a state other than SERVICE_STOPPED. If this setting is 1, the SCM enables configured failure actions on the service if the service enters the SERVICE_STOPPED state with a Win32 exit code other than 0 in addition to the service process termination as above. This setting is ignored if the service does not have any failure actions configured.
A similar description can be found here.
So, the correct answer to the original question is: the configured recovery actions always take effect when your service doesn't terminate in the SERVICE_STOPPED state.
"Enable actions for stops with errors" must be checked if you need to enable the recovery actions also when your service enters the SERVICE_STOPPED state, provided that the exit code is not 0 (error).