3.1.4.1.1 Add Task

First, the client MUST construct an AT_INFO structure (section 2.3.4) to specify the task:

  • The JobTime, DaysOfMonth, and DaysOfWeek fields MUST specify the time and day (or days) at which the task will run.

  • The Flags field MUST be set to zero, except for the following bit flags:

    • JOB_RUN_PERIODICALLY to specify that the server MUST run the task on a repeating schedule.

    • JOB_ADD_CURRENT_DATE to specify that the server MUST set the current day in the DaysOfMonth field.

    • JOB_NONINTERACTIVE to specify that this task is not interactive.

  • The Command field MUST contain a Unicode string specifying the name of the batch file or binary program to execute.

Next, the client MUST invoke the NetrJobAdd method with the following parameters:

  • A pointer to the AT_INFO structure in the pAtInfo parameter.

  • A pointer to a DWORD to receive the task ID in the pJobId parameter.

Note The server MUST allocate task IDs sequentially. See section 3.2.5.2.1.