Localsch.exe command line parameters

Version 4

    Verified Product Versions

    Endpoint Manager 9.5Endpoint Manager 9.6Endpoint Manager 2016.x

    LocalSch.exe command-line parameters:

    In additional to monitoring and running local tasks, LocalSch.exe  can be used to install or remove the service, add new tasks, and list  all of the currently configured tasks.


    The following are the command line options supported by the local scheduler application.

    LocalSch.exe [/i] [/r] [/d] [/tasks] [/isinstalled] [/del] [/removetasks]  
    [/exe=<executable>] [/cmd=<command line>] [/start=”<date/time>”] [/freq=xxx]   
    [/user] [/bw=xxx|<server>] [/tod=<begin>|<end>] [/dow=<begin>|<end>]   
    [/dom=<begin>|<end>] [/ipaddr] [/taskid=<id>] [/range=<min>|<max>]

    /i – Install service  
    Installs the local scheduler service on the device. After being installed the local scheduler will still need to be started.

    /r – Remove service   
    Removes the local scheduler service from the machine. The local scheduler service should be   
    stopped before removing the service.

    /d – Run in debug mode  
    Runs the local scheduler in a debug  mode. When run in debug mode, the local scheduler runs as a normal  Windows process rather than as a service or pseudo service. This mode  does not result in any additional debug output.

    /isinstalled – Is installed check  
    Checks to see if the local scheduler service is installed on the local computer. This method will   
    return S_OK, or zero, if the local scheduler is installed. If the local scheduler is not installed a   
    non-zero value will be returned.

    /tasks – List tasks  
    This command will output the currently configured tasks to stdout but can only be seen in a   
    command prompt if piped to more.

    LocalSch.exe /tasks | more  
    The output can be redirected to a text file, tasks.txt for example, using the following command   
    LocalSch.exe /tasks > tasks.txt


    Adding a task with LocalSch.exe

    The rest of the command-line parameters are used for adding a  local task. When adding a local task, you must specify the executable  using the /exe parameter. If the user or process executing the command  line doesn’t have administrator rights, the task won’t be scheduled. If  the current user doesn’t have administrator privileges, the task won’t  be created.   
    In addition to the command line options outlined below, the /taskid option may be used to specify the task.

    /exe=<executable> – Scheduled application  
    Specifies the  application that is to be launched when the scheduled time arrives. If  this parameter isn’t provided, the local task won’t be created.

    /cmd=<command line> – Application command line  
    Specifies the command line to be used when the scheduled application is launched. If this   
    parameter is not specified, the scheduled application will be launched without command line   

    /start="<date/time>" – Start time  
    Specifies the start  time for the application. If this parameter isn’t specified, the  application will be launched as soon as possible. If any filters are  specified they must be satisfied before the   
    application is launched. The start time is specified is in local system time of the computer and has the following format:

    /start="06 Nov 2001 17:39:47" /bw=WAN|myserver.domain.com  
    This format is a shortened version of the format used by HTTP. The month is always specified   
    using  a three-letter ASCII abbreviation: Jan, Feb, Mar, Apr, May, Jun, Jul,  Aug, Sep, Oct, Nov, or Dec. If the format of the date is specified  incorrectly, the task won’t be added.

    /freq=xxx – Frequency  
    Specifies a periodic frequency. Frequency is the number of seconds before the task will be run   
    again. If this parameter isn’t specified or is zero, the task will only be run once.

    /user – User filter  
    Specifies that a user filter should be  created for the task. A user filter will prevent the task from being run  until a user is logged onto the system.

    /bw=xxx|<network host> – Bandwidth filter  
    Specifies the  bandwidth needed to a specific network host. The bandwidth can be  specified as LAN, WAN, or RAS. If another bandwidth value is used the  local scheduler will default to RAS bandwidth. The task won’t be run  until the local scheduler detects that the specified type of bandwidth  is available between the device and the specified network host.

    For example, the following filter would specify not running the task until at least WAN connectivity  
    is available to the myserver.domain.com computer.


    /tod=<begin>|<end> – Time of day filter  
    Specifies a time of day filter. The task won’t be run unless the time of day is between the   
    specified begin and end hours. Time of day values are specified as the hour 0 through 23. For   
    example, the following filter would specify running a task between 7 p.m. and 10 p.m.


    /dow=<begin>|<end> – Day of the week filter  
    Specifies a day of the week filter. The task won’t be run unless the weekday is between the   
    specified begin and end days. Day of week values are specified as an integer with 0 being   
    Sunday. For example, the following filter would specify running a task between Sunday and   

    /dom=<begin>|<end> – Day of month filter  
    Specifies a  day of the month filter. The task won’t be run unless the day of the  month is between the specified begin and end days. The day of month  filter is specified using numeric value between 1 and 31. For example,  the following filter would specify running the task between the 16th and  28th of the month.


    /ipaddr – IP address change filter  
    Specifies that the task should be run whenever the IP address of the machine changes. This   
    functionality  requires the IP Helper libraries and is not available on Windows 95  systems and on Windows 98/NT systems without Internet Explorer 4 or  later installed.

    Deleting a task with LocalSch.exe
    The local scheduler provides the ability to delete one or more tasks. The following parameters are used when deleting tasks with Elevated Permissions.

    /del – Delete task or tasks  
    Deletes the task specified by the  /taskid parameter or deletes all tasks within the /range max and min  values inclusive. The task IDs can be determined by either looking at  the tasks using /tasks command line option or by using a constant  /taskid when adding a task.

    Example: LocalSch.exe /del /taskid=100

    /removetasks – Remove all tasks  
    Removes all currently scheduled local tasks.

    /taskid – Specifying the task ID  
    Specifies the ID of the task  that is being deleted. Task IDs can be determined by looking at the  tasks currently scheduled (see /tasks above). The ID is specified as an  integer value.

    /range=<min>|<max> – Range of task IDs  
    Specifies a minimum and maximum value of a range of task IDs. It can be used with the /del   
    command  to remove all tasks with task IDs within the given range. Normally when  generating a task an ID is randomly assigned, using the current time  (time_t) value as the task ID. A randomly assigned ID will never be less  than 100000. This command line parameter can be used to specify the ID  for the task. Task ID values 0 -1000 are reserved for internal LANDesk  Software use. Task ID values 1001-2000 are reserved for use by the  management console’s local scheduler interface.


    Character parsing and the command line
    The local scheduler uses standard white space-delimited parsing for the command line. This   
    means  that if any of the parameters contain white space they need to be  enclosed in quotation marks. Certain parameters, such as /start, always  contain white space and hence always need to be quoted. Other  parameters, such as /exe and /cmd, may or may contain white space and  may or may not need to be quoted.

    The following example shows a command line that does not need quotation marks.  
    LocalSch.exe /exe=c:\windows\system32\cmd.exe

    The following example shows a command line that does need quotation marks.  
    LocalSch.exe /exe="%ProgramFiles%\LANDesk\amclient.exe" /cmd="/apm /s /ro"


    Quoting already quoted parameters
    If the parameters that are to be passed to /cmd= are already quoted, then three quotes are   
    required. One set to quote the entire string. Another to quote the quoted values, and the quoted values.

    For example, the following command line shows an example of parameters that need to be  
    surrounded by three quotation marks.   
    LocalSch.exe /exe="%ProgramFiles%\LANDesk\File   
    /cmd="""%ProgramFiles%\LANDesk\File Replicator\LDHTTPCopyTaskConfig.xml""   
    ""%ProgramFiles%\LANDesk\File Replicator\replicator.log"""

    In the above command, the two parameter are paths to files. Because both paths are in the  
    “Program Files” directory, they paths have spaces and must be quoted in order to be proper   
    parameters for LANDeskFileReplicatorNoUI.exe. So each quoted parameter is surrounded by a   
    second set of quotes, and then the entire string is surrounded by quotes.


    Quoting redirection operators
    Quotes must also surround any switches that contain a redirection operator. Redirection   
    operators  include the following symbos: <, >, |. The /bw switch uses a |  character called a pipe or bar. It is important to remember that the |  character is used in the command prompt to pipe the output to another  application. To prevent this character from being parsed by the command  line, it must be surrounded with quotes.

    For example, the following command uses a /bw parameter with a | character and needs to be quoted.

    LocalSch.exe /exe=C:\ldclient\amclient.exe /cmd="/apm /s /ro"