ILogonTrigger::UserId property

Gets or sets the identifier of the user.

This property is read/write.

Syntax


HRESULT put_UserId(
  [in]   user
);

HRESULT get_UserId(
  [out]  *pUser
);

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.
  • Group name or SID string: The task is started when a member of the user group logs on to the computer.
  • NULL: The task is started when any user logs on to the computer.

Error codes

NameMeaning
S_OK

The property value was successfully set or retrieved.

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 UserId property. Instead, create a logon trigger with an empty UserId property and assign a value to the principal for the task using the 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

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Taskschd.h

Library

Taskschd.lib

DLL

Taskschd.dll

See also

Task Scheduler
ILogonTrigger

 

 

Show: