ITaskSettings interface

Provides the settings that the Task Scheduler service uses to perform the task.

Methods

The ITaskSettings interface has these methods.

Method Description
ITaskSettings::get_AllowDemandStart Gets or sets a Boolean value that indicates that the task can be started by using either the Run command or the Context menu.
ITaskSettings::get_AllowHardTerminate Gets or sets a Boolean value that indicates that the task may be terminated by the Task Scheduler service using TerminateProcess.
ITaskSettings::get_Compatibility Gets or sets an integer value that indicates which version of Task Scheduler a task is compatible with.
ITaskSettings::get_DeleteExpiredTaskAfter Gets or sets the amount of time that the Task Scheduler will wait before deleting the task after it expires.
ITaskSettings::get_DisallowStartIfOnBatteries Gets or sets a Boolean value that indicates that the task will not be started if the computer is running on batteries.
ITaskSettings::get_Enabled Gets or sets a Boolean value that indicates that the task is enabled. The task can be performed only when this setting is True.
ITaskSettings::get_ExecutionTimeLimit Gets or sets the amount of time that is allowed to complete the task.
ITaskSettings::get_Hidden Gets or sets a Boolean value that indicates that the task will not be visible in the UI.
ITaskSettings::get_IdleSettings Gets or sets the information that specifies how the Task Scheduler performs tasks when the computer is in an idle condition.
ITaskSettings::get_MultipleInstances Gets or sets the policy that defines how the Task Scheduler deals with multiple instances of the task.
ITaskSettings::get_NetworkSettings Gets or sets the network settings object that contains a network profile identifier and name.
ITaskSettings::get_Priority Gets or sets the priority level of the task.
ITaskSettings::get_RestartCount Gets or sets the number of times that the Task Scheduler will attempt to restart the task.
ITaskSettings::get_RestartInterval Gets or sets a value that specifies how long the Task Scheduler will attempt to restart the task.
ITaskSettings::get_RunOnlyIfIdle Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only if the computer is in an idle condition.
ITaskSettings::get_RunOnlyIfNetworkAvailable Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only when a network is available.
ITaskSettings::get_StartWhenAvailable Gets or sets a Boolean value that indicates that the Task Scheduler can start the task at any time after its scheduled time has passed.
ITaskSettings::get_StopIfGoingOnBatteries Gets or sets a Boolean value that indicates that the task will be stopped if the computer is going onto batteries.
ITaskSettings::get_WakeToRun Gets or sets a Boolean value that indicates that the Task Scheduler will wake the computer when it is time to run the task, and keep the computer awake until the task is completed.
ITaskSettings::get_XmlText Gets or sets an XML-formatted definition of the task settings.
ITaskSettings::put_AllowDemandStart Gets or sets a Boolean value that indicates that the task can be started by using either the Run command or the Context menu.
ITaskSettings::put_AllowHardTerminate Gets or sets a Boolean value that indicates that the task may be terminated by the Task Scheduler service using TerminateProcess.
ITaskSettings::put_Compatibility Gets or sets an integer value that indicates which version of Task Scheduler a task is compatible with.
ITaskSettings::put_DeleteExpiredTaskAfter Gets or sets the amount of time that the Task Scheduler will wait before deleting the task after it expires.
ITaskSettings::put_DisallowStartIfOnBatteries Gets or sets a Boolean value that indicates that the task will not be started if the computer is running on batteries.
ITaskSettings::put_ExecutionTimeLimit Gets or sets the amount of time that is allowed to complete the task.
ITaskSettings::put_Hidden Gets or sets a Boolean value that indicates that the task will not be visible in the UI.
ITaskSettings::put_IdleSettings Gets or sets the information that specifies how the Task Scheduler performs tasks when the computer is in an idle condition.
ITaskSettings::put_MultipleInstances Gets or sets the policy that defines how the Task Scheduler deals with multiple instances of the task.
ITaskSettings::put_NetworkSettings Gets or sets the network settings object that contains a network profile identifier and name.
ITaskSettings::put_Priority Gets or sets the priority level of the task.
ITaskSettings::put_RestartCount Gets or sets the number of times that the Task Scheduler will attempt to restart the task.
ITaskSettings::put_RestartInterval Gets or sets a value that specifies how long the Task Scheduler will attempt to restart the task.
ITaskSettings::put_RunOnlyIfIdle Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only if the computer is in an idle condition.
ITaskSettings::put_RunOnlyIfNetworkAvailable Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only when a network is available.
ITaskSettings::put_StartWhenAvailable Gets or sets a Boolean value that indicates that the Task Scheduler can start the task at any time after its scheduled time has passed.
ITaskSettings::put_StopIfGoingOnBatteries Gets or sets a Boolean value that indicates that the task will be stopped if the computer is going onto batteries.
ITaskSettings::put_WakeToRun Gets or sets a Boolean value that indicates that the Task Scheduler will wake the computer when it is time to run the task, and keep the computer awake until the task is completed.
ITaskSettings::put_XmlText Gets or sets an XML-formatted definition of the task settings.

Remarks

By default, a task will be stopped 72 hours after it starts to run. You can change this by changing the ExecutionTimeLimit setting.

When reading or writing XML for a task, the task settings are defined in the Settings element of the Task Scheduler schema.

When battery saver is on, Windows Task Scheduler tasks are triggered only if the task is:

  • Not set to Start the task only if the computer is idle... (task doesn't use IdleSettings)
  • Not set to run during automatic maintenance (task doesn't use MaintenanceSettings)
  • Is set to Run only when user is logged on (task LogonType is TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP)
All other triggers are delayed until battery saver is off. For more information about accessing battery saver status in your application, see SYSTEM_POWER_STATUS. For general information about battery saver, see battery saver (in the hardware component guidelines).

Examples

For more information and a code example for this interface, see Time Trigger Example (C++).

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header taskschd.h

See Also

IIdleSettings

INetworkSettings

ITaskDefinition