Principal.LogonType property

For scripting, gets or sets the security logon method that is required to run the tasks that are associated with the principal.

Syntax

Principal.LogonType As Integer

Property value

Set to one of the following TASK_LOGON TYPE enumeration constants.

Value Meaning
TASK_LOGON_NONE
0
The logon method is not specified. Used for non-NT credentials.
TASK_LOGON_PASSWORD
1
Use a password for logging on the user. The password must be supplied at registration time.
TASK_LOGON_S4U
2
Use an existing interactive token to run a task. The user must log on using a service for user (S4U) logon. When an S4U logon is used, no password is stored by the system and there is no access to either the network or encrypted files.
TASK_LOGON_INTERACTIVE_TOKEN
3
User must already be logged on. The task will be run only in an existing interactive session.
TASK_LOGON_GROUP
4
Group activation. The userId field specifies the group.
TASK_LOGON_SERVICE_ACCOUNT
5
Indicates that a Local System, Local Service, or Network Service account is being used as a security context to run the task.
TASK_LOGON_INTERACTIVE_TOKEN_OR_PASSWORD
6
First use the interactive token. If the user is not logged on (no interactive token is available), then the password is used. The password must be specified when a task is registered. This flag is not recommended for new tasks because it is less reliable than TASK_LOGON_PASSWORD.

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 interactive, specify 3 (TASK_LOGON_INTERACTIVE_TOKEN) or 4 (TASK_LOGON_GROUP) in the LogonType property of the task principal, or in the logonType parameter of TaskFolder.RegisterTask or TaskFolder.RegisterTaskDefinition.

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

Principal