Adds the task to the job.
- pTask [in]
If the method succeeds, the return value is S_OK. Otherwise, the return value is an error code. To get a description of the error, access the ISchedulerJob::ErrorMessage property.
Typically, you call this method while the job is in the Configuring state. After you submit the job (see IScheduler::SubmitJob), you must call the ISchedulerJob::SubmitTask or ISchedulerJob::SubmitTaskById method to add a task to the job if you want the task to run (if you call the AddTask method after the job is submitted, the task will not run until you submit the task). You cannot add or submit a task after the job finishes. If you call the SubmitTaskById method, you must first call the AddTask method to get a task identifier assigned to the task.
The task will run in the order in which it was added to the job.
For an example, see Creating and Submitting a Job.
HPC Pack 2008 R2 Client Utilities, HPC Pack 2008 Client Utilities