#37540 - 2003-03-07 03:21 PM
scheduletask() error with 'Interactive'...
|
Rocco Capra
Hey THIS is FUN
Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
|
All (or Jens),
I try to use the 'Interactive' option on JT.exe and get the following output...
code:
[ Setting Task Scheduler Job ] [TRACE] Created trigger 0 [TRACE] Setting account information [TRACE] Setting job's properties [ERROR] Expected job property name but found token 'Interactive' [TRACE] Setting target computer to '\\MAN07536' [TRACE] Adding job 'VNC_Mess.job' [TRACE] Activating job 'VNC_Mess.job' 0 The operation completed successfully.
...and the job is not there.
Here is the code...
code:
$taskname='VNC_Mess.job' $computer=$COMPUTER $date='TODAY' $time='$RUNTIME' $type='ONCE' $userid='taskadmin' $userpw='password' $comment='This task is to Show VNC Dissconnect Message.' $command='%WINDIR%\mess.exe' ;crypted kix script $parameters='' scheduletask($taskname,$computer,$date,$time,$type,$userid, $userpw,$comment,$command,$parameters) ? @SERROR :END GET $_ QUIT ;========================================================== ;========================================================== FUNCTION scheduletask($taskname, $computer, $date, $time, $type, $userid, $userpw, $comment, $command, $parameters) DIM $jtexe, $shellcmd, $retcode IF $taskname='' ? 'Variable TASKNAME in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $computer='' ? 'Variable COMPUTER in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $date='' ? 'Variable DATE in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $time='' ? 'Variable TIME in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $type='' ? 'Variable TYPE in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $userid='' ? 'Variable USERID in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $userpw='' ; ? 'Variable USERPW in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $comment='' ? 'Variable COMMENT in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF $command='' ? 'Variable COMMAND in function SCHEDULETASK is empty' ; EXIT 87 ENDIF IF not vartype($parameters) DIM $parameters $parameters='' ENDIF ; this should point to your copy of jt.exe $jtexe='%WINDIR%\jt.exe' ; delete a potentially existing task $shellcmd=$jtexe+' /SM \\'+$computer+' /SD '+$taskname SHELL '%COMSPEC% /e:1024 /c '+$shellcmd+" >NUL" ; IF @ERROR > 0 ; $RC = Open(2,"\\MANFP1NT\Public\IT\_RoccoC\temp\log-off_nt.txt",5) ; $RC = WriteLine(2,@SERROR+@CRLF+@ERROR+@CRLF) ; $RC = Close(2) ; ENDIF
; create a new task, save it, and force a run $shellcmd = $jtexe $shellcmd = $shellcmd+ ' /CTJ StartDate='+$date $shellcmd = $shellcmd+ ' StartTime='+$time $shellcmd = $shellcmd+ ' HasEndDate=0' $shellcmd = $shellcmd+ ' KillAtDuration=0' $shellcmd = $shellcmd+ ' Disabled=0' $shellcmd = $shellcmd+ ' Type='+$type $shellcmd = $shellcmd+ ' /SC '+$userid+' '+$userpw $shellcmd = $shellcmd+ ' /SJ ApplicationName="'+$command+'"' $shellcmd = $shellcmd+ ' Parameters="'+$parameters+'"' $shellcmd = $shellcmd+ ' WorkingDirectory="%WINDIR%"' $shellcmd = $shellcmd+ ' Comment="'+$comment+'"' $shellcmd = $shellcmd+ ' Creator="'+@USERID+'"' $shellcmd = $shellcmd+ ' Priority=Normal' $shellcmd = $shellcmd+ ' Interactive=1' $shellcmd = $shellcmd+ ' MaxRunTime=3600000' $shellcmd = $shellcmd+ ' DontStartIfOnBatteries=0' $shellcmd = $shellcmd+ ' KillIfGoingOnBatteries=0' $shellcmd = $shellcmd+ ' RunOnlyIfLoggedOn=0' $shellcmd = $shellcmd+ ' SystemRequired=0' $shellcmd = $shellcmd+ ' DeleteWhenDone=1' $shellcmd = $shellcmd+ ' Suspend=0' $shellcmd = $shellcmd+ ' StartOnlyIfIdle=0' $shellcmd = $shellcmd+ ' KillOnIdleEnd=0' $shellcmd = $shellcmd+ ' RestartOnIdleResume=0' $shellcmd = $shellcmd+ ' Hidden=0' $shellcmd = $shellcmd+ ' TaskFlags=0' $shellcmd = $shellcmd+ ' /SM \\'+$computer $shellcmd = $shellcmd+ ' /SAJ '+$taskname $shellcmd = $shellcmd+ ' /SAC '+$taskname SHELL "%COMSPEC% /e:1024 /c "+$shellcmd+" " $scheduletask=@ERROR ENDFUNCTION
If I don't use the 'Interactive' option the job gets pushed like it should, but problem is the 'MessageBox' doesn't display to the logged on user. It is running in the process window under the taskadmin account.
I guess the real question would be what do I need to do to get the logged on user to see that message box?
Here is the simple code for the mess.exe...
code:
BREAK ON $RC=MessageBox('The HelpDesk Technician has disconnected from your PC.'+@CRLF+ 'Do you want to view the log file "C:\WinVNC_log.txt" ?', @WKSTA,68) IF(@ERROR='6') RUN 'NotePad.exe "C:\WinVNC_log.txt"' ENDIF ;[ 6 = YES ] [ 7 = NO ] QUIT
TIA, Rocco
_________________________
I Love this board!!
--------------------
My DEV PC is running
KIX 4.22 WINXP Pro
|
Top
|
|
|
|
#37542 - 2003-03-07 03:55 PM
Re: scheduletask() error with 'Interactive'...
|
Rocco Capra
Hey THIS is FUN
Registered: 2002-04-01
Posts: 380
Loc: Mansfield Ohio
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|