What with the line in the first section..

Code:
scheduletask($name, $comp, $date, $time, $type, $cmd);, $user, $pw)



Shouldnt it be something like..

Code:
scheduletask($name, $comp, $date, $time, $type, $cmd, , $user, $pw)



Are you using an older version of the ScheduleTask() that didnt have the cmd prms option?