3.1.4.2.1.2 Setting Account Information

To set account information associated with a task, the client MUST invoke the SASetAccountInformation method with the following parameter values:

  • The task name in the pwszJobName parameter,

  • The name of the account (user principal name (UPN) format) under which the task is to run in the pwszAccountName parameter.

  • The password for the account in the pwszPassword parameter.

  • A DWORD flags value in the dwJobFlags parameter.

The DWORD flags value MUST be 0, except the client can set the TASK_FLAG_RUN_ONLY_IF_LOGGED_ON flag to 1 to indicate that the task MUST only run if the user specified in the pwszAccountName parameter is logged on. In this case, pwszPasswordParameter SHOULD be NULL. The client can pass an empty string for the pwszAccountName parameter and NULL for the pwszPassword parameter to specify that the task MUST run under the local system context.