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

Follow

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:

mceclip4.png

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.

mceclip5.png

 

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:

mceclip7.png

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. 

mceclip1.png

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

mceclip2.png

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

mceclip4.png

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

mceclip5.png

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

mceclip0.png

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

schtasks /run /I /TN Start_Notepad

mceclip1.png

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

mceclip2.png

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

mceclip3.png

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:

mceclip4.png

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:

mceclip8.png

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"

mceclip14.png

 

 

 

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.