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

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. We recommend using the C:\NFScripts folder to store the Powershell script that will be used to start the application, please find the command below: 


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


4. Under the Actions tab and in the Program/script field type powershell and in the Add arguments field the path to the script, like in the screenshot below:


5. Under the Conditions tab, make sure that both options under the 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 notepad_start

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

schtasks /run /I /TN notepad_start


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

mceclip10.png

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


In 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. The last step is done also in the Neverfail Advanced Management Client under the 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 the user is logged on"

 

 

 


    • Related Articles

    • How to Stop and Start Applications in Neverfail Continuity Engine

      Summary This Knowledgebase article provides information about how to start and stop applications using the Engine Management Service. More Information Neverfail Continuity Engine allows you to stop and start applications and monitoring from the ...
    • How to Create a Task In Neverfail Continuity Engine

      Summary This Knowledge base article provides general information about how to create Tasks in Neverfail Continuity Engine. More Information Tasks are a generalization and extension of start, stop, and monitor scripts. Task types are grouped by when ...
    • How to setup scheduled automatic switchover using Task Scheduler

      Summary This Knowledgebase article provides instructions on how to configure a scheduled automatic switchover between the servers in a Neverfail cluster. Such automation might be used for applying updates and patches, perform maintenance, etc ...
    • Neverfail IT Continuity Engine v8.0 - Release Notes

      Summary This Knowledge base article provides information about this specific release of Neverfail IT Continuity Engine v8.0 More Information Supporting Documentation A listing of technical documents supporting this version of Neverfail IT Continuity ...
    • Neverfail IT Continuity Engine v7.1.2 - Release Notes

      Summary This Knowledgebase article provides information about this specific release of Neverfail IT Continuity Engine v7.1.2 Overview This release of Neverfail IT Continuity Engine is a patch release that applies to Neverfail IT Continuity Engine ...