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:
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
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"