TaskServiceAddAutomaticMaintenanceTask Method
Adds or updates an Automatic Maintenance Task on the connected machine.
Namespace: Microsoft.Win32.TaskSchedulerAssembly: Microsoft.Win32.TaskScheduler (in Microsoft.Win32.TaskScheduler.dll) Version: 2.11.1
public Task AddAutomaticMaintenanceTask(
string taskPathAndName,
TimeSpan period,
TimeSpan deadline,
string executablePath,
string arguments = null,
string workingDirectory = null
)
- taskPathAndName String
- Name of the task with full path.
- period TimeSpan
- The amount of time the task needs once executed during regular Automatic maintenance.
- deadline TimeSpan
-
The amount of time after which the Task Scheduler attempts to run the task during emergency Automatic maintenance, if the task
failed to complete during regular Automatic Maintenance.
- executablePath String
- The path to an executable file.
- arguments String (Optional)
- The arguments associated with the command-line operation.
- workingDirectory String (Optional)
-
The directory that contains either the executable file or the files that are used by the executable file.
TaskA
Task instance of the Automatic Maintenance Task.