TaskSettings object

A scripting object that provides the settings that the Task Scheduler service uses to perform the task.

Members

The TaskSettings object has these types of members:

Properties

The TaskSettings object has these properties.

Property Access type Description
AllowDemandStart
Read/write
Gets or sets a Boolean value that indicates that the task can be started by using either the Run command or the Context menu.
AllowHardTerminate
Read/write
Gets or sets a Boolean value that indicates that the task may be terminated by using TerminateProcess.
Compatibility
Read/write
Gets or sets an integer value that indicates which version of Task Scheduler a task is compatible with.
DeleteExpiredTaskAfter
Read/write
Gets or sets the amount of time that the Task Scheduler will wait before deleting the task after it expires.
DisallowStartIfOnBatteries
Read/write
Gets or sets a Boolean value that indicates that the task will not be started if the computer is running on battery power.
Enabled
Read/write
Gets or sets a Boolean value that indicates that the task is enabled. The task can be performed only when this setting is True.
ExecutionTimeLimit
Read/write
Gets or sets the amount of time allowed to complete the task.
Hidden
Read/write
Gets or sets a Boolean value that indicates that the task will not be visible in the UI. However, administrators can override this setting through the use of a "master switch" that makes all tasks visible in the UI.
IdleSettings
Read/write
Gets or sets the information that specifies how the Task Scheduler performs tasks when the computer is in an idle state.
MultipleInstances
Read/write
Gets or sets the policy that defines how the Task Scheduler deals with multiple instances of the task.
NetworkSettings
Read/write
Gets or sets the network settings object that contains a network profile identifier and name. If the RunOnlyIfNetworkAvailable property of TaskSettings is True and a network propfile is specified in the NetworkSettings property, then the task will run only if the specified network profile is available.
Priority
Read/write
Gets or sets the priority level of the task.
RestartCount
Read/write
Gets or sets the number of times that the Task Scheduler will attempt to restart the task.
RestartInterval
Read/write
Gets or sets a value that specifies how long the Task Scheduler will attempt to restart the task.
RunOnlyIfIdle
Read/write
Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only if the computer is in an idle state.
RunOnlyIfNetworkAvailable
Read/write
Gets or sets a Boolean value that indicates that the Task Scheduler will run the task only when a network is available.
StartWhenAvailable
Read/write
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.
StopIfGoingOnBatteries
Read/write
Gets or sets a Boolean value that indicates that the task will be stopped if the computer begins to run on battery power.
WakeToRun
Read/write
Gets or sets a Boolean value that indicates that the Task Scheduler will wake the computer when it is time to run the task.
XmlText
Read/write
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.

Examples

For more information and a code example for this scripting object, see Time Trigger Example (Scripting).

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Type library
Taskschd.tlb
DLL
Taskschd.dll

See also

Task Scheduler

TaskDefinition

NetworkSettings

IdleSettings