The following example executes multiple jobs for an automation profile




# Set the unique identifier of the automation profile to execute.

$profileIdentifier = "207dd2fe-9380-4869-a6c3-39dae9a8bebb";


# Create a new jobs collection for the specified automation profile.

$jobs = $automation.DO_CreateJobs($profileIdentifier);


# Create a job and set the variables.

$job = $automation.DO_CreateJob();

$job = $automation.DO_AddVariable($job, "FirstName", "Tariq");

$job = $automation.DO_AddVariable($job, "LastName", "Razzaq");

$jobs.Job += $job;



# Create a job and set the variables.

$job2 = $automation.DO_CreateJob();

$job2 = $automation.DO_AddVariable($job2, "FirstName", "Sarah");

$job2 = $automation.DO_AddVariable($job2, "LastName", "Jackson");

$jobs.Job += $job2;



# Execute the jobs.

$jobsIdentifier = $automation.DO_ExecuteJobs($jobs); 



NOTE: The automation profile must have web service access enabled else an access denied exception will be thrown.