How to send a custom task status with SendTaskStatus.exe

Version 11

    Verified Product Versions

    Endpoint Manager 9.6Endpoint Manager 2016.xEndpoint Manager 2017.x

    Purpose

     

    In some special cases, it is necessary to send up custom messages to the console during a deployment task.  For large deployment packages that are scripted, it is helpful still to send a status up to the core detailing what step the task is on. Previously this was possible by using the following command in your script.

    "%LDMS_LOCAL_DIR%\..\SDClient.exe" /taskid=%task_id% /msg="Any Message"

     

    However, this method is being deprecated and replaced with SendTaskStatus.exe which is a more capable process dedicated specifically to sending a task status for any type of task to the core server.

     

    Description

     

    Here are the command line options for SendTaskStatus.exe. The required parameters are "-core", "-taskId", and "-retcode" all others are optional.

     

    Command line syntax:

    sendtaskstatus.exe -core=<core> -taskId=<taskId> -retcode=<return code> -message="message"

     

    Arguments:

     

    • -core
      • Name of the Core Server
    • -coreandip
      • The IP Address of the core server, or the name/IP address of the core server.
    • -taskId
      • ID for which the return code is to be updated. You can use the %task_id% variable for this parameter to avoid having to set the task ID manually in each script every time they are scheduled.
    • -return code
      • Current return code for the task. If using a BAT script and you'd like to pass up the return code for the most recent action in the script you can use the %errorlevel% variable.

     

    Optional Arguments:

     

    • -complete
      • When specified the task is treated as being completed and will be moved to either the Successful or Failed status buckets in the task depending on the return code.
    • -message
      • A custom message to be displayed in the scheduled task message column in the console.
    • -ldap
      • LDAP information to be reported with the status.
    • -log=<file>
      • Path to a log file which will be reported.
    • -pkgId=<id>
      • Software distribution tasks use the package id to update a set of tasks that all target the same package.

     

    Example Command of a simple task message update used in a BAT script:

    "%LDMS_LOCAL_DIR%\..\SendTaskStatus.exe" -core=mycore.landesk.com -taskid=%task_ID% -retcode=%errorlevel% -message="Configuring System"