IPrincipal::put_LogonType method (taskschd.h)

Gets or sets the security logon method that is required to run the tasks that are associated with the principal.

This property is read/write.

Syntax

HRESULT put_LogonType(
  TASK_LOGON_TYPE logon
);

Parameters

logon

Return value

None

Remarks

This property is valid only when a user identifier is specified by the UserId property.

When reading or writing XML for a task, the logon type is specified in the <LogonType> element of the Task Scheduler schema.

For a task, that contains a message box action, the message box will be displayed if the task is activated and the task has an interactive logon type. To set the task logon type to be interactive, specify TASK_LOGON_INTERACTIVE_TOKEN or TASK_LOGON_GROUP in the LogonType property of the task principal, or in the logonType parameter of ITaskFolder::RegisterTask or ITaskFolder::RegisterTaskDefinition.

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).

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header taskschd.h
Library Taskschd.lib
DLL Taskschd.dll

See also

IPrincipal

Task Scheduler