The local scheduler is a service that runs on devices. It's part of the common base agent and you can install it through device setup. Usually the local scheduler handles Management Suite tasks, such as running the inventory scanner periodically. Other tasks that you schedule, such as software or OS deployments, are handled by the core server rather than the local scheduler. You can use the local scheduler to schedule your own tasks to run periodically on devices. Once you create a local scheduler script, you can deploy it to devices by using the Scheduled tasks window.
The local scheduler assigns each task an ID number. Local scheduler scripts have an ID range that is different from the default local scheduler scripts that Management Suite uses. By default, you can only have one custom scheduler script active on each device. If you create a new script and deploy it to devices, it will replace the old script (any script in the custom local scheduler ID range) without affecting the default local scheduler scripts, such as the local inventory scan schedule.
When selecting schedule options, don't be so restrictive that the task criteria are infrequently met, unless that's your intention. For example, while configuring a task, if you select Monday as the day of the week and 17 as the day of the month, the task will only execute on a Monday that's also the 17th of the month, which happens very infrequently.
The LANDesk Local Scheduler service can be installed on an unmanaged device. Only two files are required for local scheduler functionality:
To install the LANDesk Local Scheduler service on an unmanaged server or workstation, follow the steps below.
%ProgramFiles%\LANDesk\LDClient
“%ProgramFiles%\LANDesk\LDClient\localsch.exe” /i
To uninstall the LANDesk Local Scheduler service, follow the steps below.
“%ProgramFiles%\LANDesk\LDClient\localsch.exe” /r
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>]
Installs the local scheduler service on the device. After being installed the local scheduler will still need to be started.
Removes the local scheduler service from the device. The local scheduler service should be stopped before you remove it.
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.
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.
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 line:
LocalSch.exe /tasks > tasks.txt
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.
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.
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 parameters.
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.
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.
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.
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.
/bw=WAN|myserver.domain.com
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.
/tod=19|22
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 Thursday.
/dow=0|4
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.
/dom=16|28
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.
The local scheduler provides the ability to delete one or more tasks. The following parameters are used when deleting 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.
Removes all currently scheduled local tasks.
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.
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 use. Task ID values 1001-2000 are reserved for use by the management console's local scheduler interface.
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 not 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%\MyProgram\myprog.exe" /cmd="/apm /s /ro"
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 third for 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 Replicator\LANDeskFileReplicatorNoUI.exe" /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, the 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.
Quotes must also surround any switches that contain a redirection operator. Redirection operators include the following symbols: <, >, |. 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\myprogram.exe /cmd="/apm /s /ro" /bw="LAN|server"