Hi Everybody,

I have two scripts that uses the Scheduletask UDF. A script which schedule a task on a single computer and one that schedule a task on multiple computers. The first one works great but the second one gives an Error 1 - Incorrect function. I have tried everything but I cann't solve the problem

Someone any idea??

Happy New Year !!!
Code:
 
;Schedule a task on a single computer
;
;
;Dependencies: UDF's: Scheduletask
; Tools: Jt.exe

; Calling UDF's
;--------------
Call "@ScriptDir\UDF\Scheduletask.udf"
Break On

$name='sync_scripts_dir'
$comp='comp1'
$date='TODAY'
$time='17:30'
$type='ONCE'
$cmd='\\comp1\Scripts\kix\sync_scripts_dir.exe'
;$user='admin'
;$pw='adminpw'
;$comment='test'
;$jt= 'c:\jt.exe'
?@ERROR
scheduletask($name, $comp, $date, $time, $type, $cmd);, $user, $pw)
?@ERROR
? @SERROR
Exit





Code:
 

;Schedule a task on multiple computers
;
;
;Dependencies: UDF's: Scheduletask, Serialtime, DateMath, SerialDate, abs.
; ; Netview2, Osid
; Service: Task Scheduler must be installed and running.
; Tools: Jt.exe

; Calling UDF's
;--------------
Break On
Call "@ScriptDir\UDF\Scheduletask.udf"
Call "@ScriptDir\UDF\Serialtime_hours.udf"
Call "@ScriptDir\UDF\DateMath.udf"
Call "@ScriptDir\UDF\SerialDate.udf"
Call "@ScriptDir\UDF\abs.udf"
;Call "@ScriptDir\UDF\Netview2.udf"
;Call "@ScriptDir\UDF\Osid.udf"
; variables
;----------
Dim $computers, $comp, $name, $date, $type, $cmd, $timediff, $time, $rc
;
$name='test'
$date=@DATE
$type='ONCE'
$cmd='c:\windows\notepad.exe'
$timediff='00:30'
$time='16:30'


; Domain scan
;------------------------------
;
;$computers=netview2(Domain)
;

;$computers = 'comp1','comp2','comp3','comp4','comp5','comp6','comp7','comp8','comp9','comp10'; etc
For Each $comp In $computers


; filter
;------------------------------
;$os = osid($comp)
;
;If $os[1]='Win2K' AND $os[2]<>'Workstation' AND InStr($comp,"comp")<>0
;
;
;$time=serialtime(serialtime($time)+ serialtime($timediff))


; Date
;------------------------------
;
;If $time='00:00' OR $time='24:00'
; $date= DateMath($date, 1)
;EndIf


; Schedule Task
;------------------------------
;
$rc=scheduletask($name, $comp, $date, $time, $type, $cmd)
? 'Error '+@ERROR+' - '+@SERROR

Next

;Get $rc

Exit



UDF: ScheduleTask
UDF: Serialtime
UDF: Datemath
UDF: SerialDate
UDF: Abs
UDF: NetView2
UDF: OSID
_________________________
Co