When I input my parameters and setup the action this is the script that will be run (if it helps).
action parameter query “RunTime” with description “Please supply the schedule time. (Use 24 hour time in the format HH:MM)” with default “”
action parameter query “Interval” with description “Please specify the schedule interval as one or more days of the week (use the following abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31). Use commas to separate multiple interval entries.” with default “”
if {(version of operating system < “6.2”)}
dos at {parameter “RunTime” of action} {if (parameter “Interval” of action equals “”) then ("") else ("/every:" & parameter “Interval” of action)} sc config BESClient start= delayed-auto
dos at {(first 5 of following text of position 17 of ((((first 17 of (now as string)) & parameter “RunTime” of action & (last 9 of (now as string))) as time + 1 * minute) as string))} {if (parameter “Interval” of action equals “”) then ("") else ("/every:" & parameter “Interval” of action)} “{pathname of system folder & “\cmd.exe”}” /c net start BESClient
else
parameter “scheduleMON” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “m”))) as integer >=1 ) then (“MON,”) else (”")}“
parameter “scheduleTUE” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “t”))) as integer >=1 ) then (“TUE,”) else (””)}“
parameter “scheduleWED” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “w”))) as integer >=1 ) then (“WED,”) else (””)}“
parameter “scheduleTHU” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “th”))) as integer >=1 ) then (“THU,”) else (””)}“
parameter “scheduleFRI” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “f”))) as integer >=1 ) then (“FRI,”) else (””)}“
parameter “scheduleSAT” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “s”))) as integer >=1 ) then (“SAT,”) else (””)}“
parameter “scheduleSUN” = “{if ((number of ((substrings separated by “,” of (parameter “Interval” of action as lowercase)) whose (it equals “su”))) as integer >=1 ) then (“SUN,”) else (””)}"
parameter “temp” = “{parameter “scheduleMON” & parameter “scheduleTUE” & parameter “scheduleWED” & parameter “scheduleTHU” & parameter “scheduleFRI” & parameter “scheduleSAT” & parameter “scheduleSUN”}“
parameter “scheduleALL” = “{if (parameter “temp” is not equal to “”) then (preceding text of last “,” of parameter “temp”) else (””)}”
dos schtasks /create /tn RestartStoppedBESClientsa21 /f /ru SYSTEM /st {parameter “RunTime” of action} {if (parameter “scheduleALL” equals “” AND parameter “Interval” of action is not equal to “”) then ("/sc monthly /d " & concatenation “-” of (substrings separated by “,” of parameter “Interval” of action)) else if (parameter “Interval” of action is not equal to “”) then ("/sc weekly /d " & parameter “scheduleALL”) else ("/sc weekly /d MON,TUE,WED,THU,FRI,SAT,SUN")} /tr “{pathname of system folder & “\sc.exe config BESClient start= delayed-auto”}”
dos schtasks /create /tn RestartStoppedBESClientsa22 /f /ru SYSTEM /st {(first 5 of following text of position 17 of ((((first 17 of (now as string)) & parameter “RunTime” of action & (last 9 of (now as string))) as time + 1 * minute) as string))} {if (parameter “scheduleALL” equals “” AND parameter “Interval” of action is not equal to “”) then ("/sc monthly /d " & concatenation “-” of (substrings separated by “,” of parameter “Interval” of action)) else if (parameter “Interval” of action is not equal to “”) then ("/sc weekly /d " & parameter “scheduleALL”) else ("/sc weekly /d MON,TUE,WED,THU,FRI,SAT,SUN")} /tr "{pathname of system folder & “\cmd.exe /c net start BESClient”}"
endif