Description
Local Scheduler is a service used by LANDesk to cause scheduled tasks to occur.
One of the primary designs of Local Scheduler is to prevent all actions on all nodes from occurring at the same time. The scheduler service allows for randomizations and does not have a setting to have a task start at an exact time repetively. For example, if every machine is configured to run an inventory scan every day at 8:00 am, they will all run at different times between 8:00 am and 9:00 am. Also, the start time increases by one day (86400 seconds) from the time the task launches, not from the start time listed.
This prevents the agent workstations from causing network storms and/or utilizing all available resource on the Core Server or another server.
Syntax
The following describes the local scheduler syntax.
localsch.exe /exe=<executable> [/cmd=<command line>] [/start="<date/time>"] [/freq=xxx] [/user] [/ipaddr] [/bw=xxx|<server>] [/tod="<begin>|<end>"] [/dow="<begin>|<end>"] [/dom="<begin>|<end>"] [/taskid=<id>] [/toe="<logon>|<lock>|<unlock>|<startscreensaver>|<stopscreensaver>|<logoff>"] [/todr="<begin>|<end>"] [/autodelay="<min delay minutes>|<max delay minutes>"]
Note:
Please note that some switches only work with Management Suite 8.8 and later. LocalSch.exe /? brings up the command line syntax. It is displayed in a pop-up window an not in the command line. The pop-up window only opens if the user is a local administrator. Use this command to see which switches are available for your version of Management Suite.
Service Related Switches Not Listed in the Command Line Parameters
In additional to monitoring and running local tasks, the local scheduler executable 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.
/i – Install service
This command is used to install the local scheduler service on the machine. After being installed the local scheduler will still need to be started.
/r – Remove service
This command is used to remove the local scheduler service from the machine. The local scheduler service should be stopped before removing the service.
/d – Run in debug mode
This command line parameter is used to run 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 nonzero value will be returned.
/tasks – List tasks
This command will output the currently configured tasks. However, this does not output the information to stdout. Currently you must pipe the output to more to see the local scheduler tasks in the command line:
LocalSch.exe /tasks |more
The output can also be redirected to a text file, tasks.txt for example, using the following command line:
LocalSch.exe /tasks > tasks.txt
Command Line Parameters for Adding a Local Task
The following command line parameters are used for adding a local task. When adding a local task it is required that the executable be specified, using the /exe parameter. If the user or process executing the command line does not have administrator rights, the task will not be scheduled. If the current user does not have administrator privileges, the task will not 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
This parameter specifies the application that is to be launched when the scheduled time arrives. If this parameter is not provided, the local task will not 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 parameters.
/start="<date/time>" – Start time
Specifies the start time for the application. If this parameter is not 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"
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 will not be added.
/freq=xxx – Frequency
If the task is to be periodic the frequency of the task must be specified. Frequency is the number of seconds before the task will be run again. If this parameter is not specified or is zero, the task will only be run once.
/user – User filter
Indicates 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
This parameter is used to specify 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 will not be run until the local scheduler detects that the specified type of bandwidth is available between the computer 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
/tod=<begin>|<end> - Time of day filter
Parameter for specifying a time of day filter. The task will not 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
/dow=<begin>|<end> - Day of the week filter
Parameter for specifying a day of the week filter. The task will not 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
/toe - Computer status filter
If specified the task will not be run unless the machine enters the specified status, such as logon,
lock, unlock, startscreensaver, stopscreensaver and logoff. To specify one or more statuses: /toe="logon|lock"
/dom=<begin>|<end> - Day of month filter
Parameter for specifying a day of the month filter. The task will not 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
/ipaddr - IP address change filter
This parameter is used to specify 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.
/autodelay=<min delay minutes>|<max delay mintues>
Parameter for specifying a random autodelay time filter. If specified, the task will not be run unless it is delayed a random time after all filters meet.
/todr=<begin>|<end> Random time filter
Parameter for specifying a random time filter. If specified, the task will not be run unless it is a
random time between the specified begin and end hours.
Command Line Parameters for Deleting Local Tasks
The local scheduler provides the ability to delete one or more tasks. The following parameters are used when deleting tasks.
/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.
/removetasks – Remove all tasks
This command line option removes all currently scheduled local tasks.
/taskid – Specifying the task ID
This parameter is used to specify 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.
Note: If calling localsched.exe /tasks, the taskid is listed as 'handle'
/range=<min>|<max> – Range of task IDs
This parameter is used to specify 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 Console Local Scheduler UI.
Command Line Parsing
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, will always contain white space and hence will 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:\ldclient\amclient.exe /cmd=/tcs
The following command line shows an example of one that does need quotation marks:
LocalSch.exe /exe="C:\program files\LANDesk\LDclient\amclient.exe" /cmd="/apm /s /ro"
Also, when launching the local scheduler with a command line from the Cmd prompt it is important to remember that the | character is used in the command prompt to pipe the output to another application. When specifying a filter through the Cmd prompt it is important to enclose any parameter using the | character in quotation marks. For example:
LocalSch.exe /exe=C:\ldclient\amclient.exe /cmd=tcs /bw="LAND|ServerName"
Sometimes, there must be quotes inside of quotes. If quotes are needed inside of quotes, use double quotes inside of quotes.
Localsch.exe /exe="cscript.exe" /cmd="""C:\Program files\vbscript.vbs"" ""C:\documents and settings\allusers\somedatafile.txt""" /taskid=1001 /freq=86400
This can make the quotes appear to be "triple quotes"at the start and at the end. However, this is just a combination of the initial quote or end quote with the inside doublequotes. If the first and last parameter do not need quotes but a middle parameter does, it would appear as follows:
LocalSch.EXE /exe="somefile.exe" /cmd="param1 ""param 2"" param3"