How To Start and Stop An EXE Process With Engine By Using Windows Task Scheduler


For exemplification purposes we'll be using Notepad.exe as a process that will be started and stopped. 

1. Open Neverfail Advanced Management Client and under Applications\Plugins section, Edit the System Plugin and make sure it is configured to Protect Task Scheduler:


2. Create or Copy a shortcut for the executable that you want to start in a new folder. We recommend using C:\Program Files\Neverfail\R2\Scripts folder.



3. Open Windows Task Scheduler console and create a new task named Start_Notepad. Make sure that Run with highest privileges is selected and also that the Configure field contains the right OS:


4. Under Actions tab and in the Program/script field type the path and the shortcut file ( .LNK) created at step 2 just like in the screenshot below.

Do not use the Browse button because that will paste the path to the executable itself and this  will make the task not to work properly for executables that need to interact with Desktop. 


5. Under Conditions tab, make sure that both options under Power section are unchecked/disabled:


6. Under Settings tab, adjust the recovery actions based on user needs:


7. Next click on OK and enter the credentials under which the task will run:


8. Open Neverfail Advanced Management Client and from Applications\Tasks section Add a new task as a Post Start, called Enable_Notepad and containing the below command:

schtasks /change /enable /TN Start_Notepad


9. Add a second Post Start task called Run_Notepad and containing the command below:

schtasks /run /I /TN Start_Notepad


10. In the same folder where the shortcut at step 1 has been created/copied, create a Stop_Notepad.cmd file containing the command below: 

taskkill /FI "IMAGENAME eq notepad*" /T /F


11. In the Neverfail Advanced Management Client create a Pre Stop task called Stop_Notepad and containing the below command:

C:\Program Files\Neverfail\R2\Scripts\Stop_Notepad.cmd


12. Also in Neverfail Advanced Management Client, create another Pre Stop task called Disable_Notepad and containing the below command:

schtasks /change /disable /TN Start_Notepad


At the end there must be Four tasks in the Neverfail Advanced Management Client. Two Post Start tasks and Two Pre Stop tasks just like in the screenshot below:


13. Last step is done also in the Neverfail Advanced Management Client under Data\File Filters section where an Inclusion Filter needs to be added for replicating the scripts to the Secondary server:


IMPORTANT NOTE: If the application/process fails to interact with the Desktop, you might need to change the user account setting to "Run only when user is logged on"





0 out of 0 found this helpful



Please sign in to leave a comment.