The following article was the closest one I found when looking for scripting for CCS. I was told `new job ..` will return JOBID but not sure in what format!!- it is actually a string of 4 terms. Was not quite apparent from what was there on the example script which failed to run at the %CCS_JOBID% part (see URL below).

I came up with a hack to fix that - I think we can use scaler instead of the implicit way of coercing the string to number. So first I substr the number as string - then coerce it to number and use it! The hack I used (based on the script that uses %CCS_JOBID% at Look at the script posted on http://technet2.microsoft.com/windowsserver/en/library/30f7fbc9-af05-4bd4-97d5-aa9f97a3f6961033.mspx?mfr=true

 

# create new job
$id = `job new /numprocessors:4`;
# print $id;
$id = substr($id, 16,4) + 0;
# print $id;
# add parametric tasks
for ($i = 0; $i < 5 ; $i++) {
 `job add $id /stdin:\\fileshare\infile$i.txt /stdout:outfile$i.txt myapp.exe`;
}

`job submit /ID:$id`;