LogonTrigger.UserId property

For scripting, gets or sets the identifier of the user.

Syntax

LogonTrigger.UserId As String

Property value

The identifier of the user. For example, "MyDomain\MyName" or for a local account, "Administrator".

This property can be in one of the following formats:

  • User name or SID: The task is started when the user logs on to the computer.
  • NULL: The task is started when any user logs on to the computer.

Remarks

If you want a task to be triggered when any member of a group logs on to the computer rather than when a specific user logs on, then do not assign a value to the LogonTrigger.UserId property. Instead, create a logon trigger with an empty LogonTrigger.UserId property and assign a value to the principal for the task using the Principal.GroupId property.

When reading or writing XML for a task, the logon user identifier is specified using the UserId element of the Task Scheduler schema.

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

LogonTrigger

Task Scheduler