Task.LastTaskResult Property
Gets the results that were returned the last time the registered task was run.
Namespace: Microsoft.Win32.TaskSchedulerAssembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.1
public int LastTaskResult { get; }
Property Value
Int32 The value returned is the last exit code of the last program run via an
ExecAction.
if (TaskService.Instance.GetTask("MyTask").LastTaskResult != 0)
MessageBox.Show("This program has an error.");