2.15. Task scheduler

The TaskService is accessible via windows.system.task_scheduler

Note

See sample Scheduled tasks

2.15.1. TaskService

class windows.winobject.task_scheduler.TaskService[source]

Bases: ITaskService

The task scheduler

__call__(name)

Alias for folder()

create(flags=0)[source]

Create a new TaskDefinition that can be used to create/register a new scheduled task

Return type:

TaskDefinition

folder(name)[source]

Return the TaskFolder with name

Return type:

TaskFolder

from_param()

Convert a Python object into a function call parameter.

property root

The root \ TaskFolder

value

current value

2.15.2. TaskFolder

class windows.winobject.task_scheduler.TaskFolder[source]

Bases: ITaskFolder

A folder of tasks

__call__(name)

Alias for folder()

__delitem__(name)

Alias for delete_task()

__getitem__(name)

Alias for get_task()

create_folder(name)[source]

Create a new sub-TaskFolder with name

delete_folder(name)[source]

Delete the sub-folder with name in the current folder

delete_task(name)[source]

Delete the task with name in the current folder

folder(name)[source]

Return the TaskFolder with name

property folders

The list of sub-folders

Type:

TaskFolderCollection

from_param()

Convert a Python object into a function call parameter.

get_task(name)[source]

Retrieve the task with name in the current folder

Return type:

Task

register(name, taskdef, flags=_TASK_CREATION.TASK_CREATE(0x2), userid=None, password=None, logonType=_TASK_LOGON_TYPE.TASK_LOGON_NONE(0x0), ssid=None)[source]

Register the task definition taskdef as a new task with name

Return type:

Task

property tasks

The list of tasks in the folder

Type:

TaskCollection

value

current value

2.15.3. Task

class windows.winobject.task_scheduler.Task[source]

Bases: IRegisteredTask

A scheduled task

property definition

The definition of the task

Type:

TaskDefinition

property enabled

True is the task is enabled

from_param()

Convert a Python object into a function call parameter.

property last_runtime

Gets the last time the registered task was last run.

property name

The name of the task

property next_runtime

Gets the next time the registered task will be run.

property path

The path of the task

property state

The state of the task

Type:

TASK_STATE

value

current value

property xml

The XML representig the task

Type:

str

2.15.4. TaskDefinition

class windows.winobject.task_scheduler.TaskDefinition[source]

Bases: ITaskDefinition

The definition of a task

property actions

The list of actions of the task

Type:

ActionCollection

from_param()

Convert a Python object into a function call parameter.

property principal

The principal that provides the security credentials for the task. These security credentials define the security context for the tasks that are associated with the principal.

Type:

TaskPrincipal

property registration_info

The registration information of the task

Type:

TaskRegistrationInfo

property triggers

The list of triggers of the task

Type:

TriggerCollection

value

current value

property xml

The XML representig the task definition

Type:

str

2.15.4.1. TaskPrincipal

class windows.winobject.task_scheduler.TaskPrincipal[source]

Bases: IPrincipal

Provides the security credentials for a principal. These security credentials define the security context for the tasks that are associated with the principal.

from_param()

Convert a Python object into a function call parameter.

property group_id

the user group that is required to run the task

property id

the identifier of the principal.

property logon_type

logon method that is required to run the task

Type:

TASK_LOGON_TYPE

property name

The name of the principal

property run_level

the privilege level that is required to run the tasks

Type:

TASK_RUNLEVEL_TYPE

property user_id

the user identifier that is required to run the task

value

current value

2.15.4.2. TaskRegistrationInfo

class windows.winobject.task_scheduler.TaskRegistrationInfo[source]

Bases: IRegistrationInfo

Provides the administrative information that can be used to describe the task.

This information includes details such as a description of the task, the author of the task, the date the task is registered, and the security descriptor of the task.

property author

The author of the task

property date

The registration date of the task

property description

The description of the task

property documentation

Any additional documentation for the task

from_param()

Convert a Python object into a function call parameter.

property source

Where the task originated from.

For example, a task may originate from a component, service, application, or user.

property uri

the URI of the task.

value

current value

property version

The version number of the task.

2.15.5. Action

2.15.5.1. Action

class windows.winobject.task_scheduler.Action[source]

Bases: IAction, AbstractAction

Describe an action performed by a task

from_param()

Convert a Python object into a function call parameter.

property id

The action id

Type:

BSTR

property subtype

Return the Action-subtype according to AbstractAction.type

property type

The type of action

Type:

TASK_ACTION_TYPE

value

current value

2.15.5.2. ExecAction

class windows.winobject.task_scheduler.ExecAction[source]

Bases: IExecAction, AbstractAction

Represent an action of type TASK_ACTION_EXEC

property arguments

[R-W] The arguments for the command to execute

from_param()

Convert a Python object into a function call parameter.

property id

The action id

Type:

BSTR

property path

[R-W] The path of the programm to execute

property type

The type of action

Type:

TASK_ACTION_TYPE

value

current value

property working_directory

The working directory for the command to execute

2.15.5.3. ComHandlerAction

class windows.winobject.task_scheduler.ComHandlerAction[source]

Bases: IComHandlerAction, AbstractAction

Represent an action of type TASK_ACTION_COM_HANDLER

property classid

The CLSID of the COM server executed

Type:

BSTR

property data

The DATA for the COM class

Type:

BSTR

from_param()

Convert a Python object into a function call parameter.

property id

The action id

Type:

BSTR

property type

The type of action

Type:

TASK_ACTION_TYPE

value

current value

2.15.6. Trigger

class windows.winobject.task_scheduler.Trigger[source]

Bases: ITrigger

A task trigger

from_param()

Convert a Python object into a function call parameter.

property type

The type of trigger

Type:

TASK_TRIGGER_TYPE2

value

current value

2.15.7. Collections

2.15.7.1. TaskFolderCollection

class windows.winobject.task_scheduler.TaskFolderCollection[source]

Bases: ITaskFolderCollection, TaskCollectionType

ITEM_TYPE

alias of TaskFolder

from_param()

Convert a Python object into a function call parameter.

get_item(index)

Return elements nb index. Collection index starts at 1

property items

Return the list of item in the collection

Type:

list

value

current value

2.15.7.2. TaskCollection

class windows.winobject.task_scheduler.TaskCollection[source]

Bases: IRegisteredTaskCollection, TaskCollectionType

ITEM_TYPE

alias of Task

from_param()

Convert a Python object into a function call parameter.

get_item(index)

Return elements nb index. Collection index starts at 1

property items

Return the list of item in the collection

Type:

list

value

current value

2.15.7.3. ActionCollection

class windows.winobject.task_scheduler.ActionCollection[source]

Bases: IActionCollection, TaskCollectionType

ITEM_TYPE

alias of Action

create(action_type)[source]

Create a new action of type action_type

Return type:

A subclass of Action

from_param()

Convert a Python object into a function call parameter.

get_item(index)[source]

Return elements nb index. Collection index starts at 1

property items

Return the list of item in the collection

Type:

list

value

current value

2.15.7.4. TriggerCollection

class windows.winobject.task_scheduler.TriggerCollection[source]

Bases: ITriggerCollection, TaskCollectionType

ITEM_TYPE

alias of Trigger

from_param()

Convert a Python object into a function call parameter.

get_item(index)

Return elements nb index. Collection index starts at 1

property items

Return the list of item in the collection

Type:

list

value

current value