NetScheduleJobAdd

The NetScheduleJobAdd function submits a job to run at a specified future time and date. This function requires that the Schedule service be started at the computer to which the job is submitted.

Security Requirements

Only members of the Administrators local group can successfully execute NetScheduleJobAdd on a remote server.

NET_API_STATUS NetScheduleJobAdd(
  LPWSTR Servername,  
  LPBYTE Buffer,      
  LPDWORD JobId       
);
 

Parameters

Servername
Pointer to a Unicode string containing the name of the remote server on which the function is to execute. A NULL pointer or string specifies the local computer.
Buffer
Pointer to a buffer containing an AT_INFO structure describing the job to be submitted.
JobId
Pointer to a job identifier for a newly submitted job. This entry is valid only if the function returns successfully.

Remarks

If you set DaysOfMonth and DaysOfWeek to zero, then the job executes only once, the first time JobTime at the server is reached. After being executed, the job will be deleted.

If one sets bits in DaysOfMonth and/or DaysOfWeek, but do not set the bit flag JOB_RUN_PERIODICALLY, a job will execute at JobTime once for each day listed in days bitmasks. See the AT_INFO structure for a descritpion of the bitmasks. After each execution, the corresponding bit in days bitmasks will be cleared. Once the last bit in days bitmasks is cleared, the job will be deleted.

If one sets bits in DaysOfMonth and/or DaysOfWeek, and at the same time set the bit flag JOB_RUN_PERIODICALLY, a job executes at JobTime whenever a day with the corresponding bit in days bitmasks is reached. See the AT_INFO structure for a descritpion of the bitmasks. This job is thus executed periodically and does not get deleted as a result of repeated executions. The only way to delete this job is by an explicit call to NetScheduleJobDel.

QuickInfo

  Windows NT: Requires version 3.1 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in lmat.h.
  Import Library: Use netapi32.lib.

See Also

Networking (Net) Overview, Net Functions