Issue: Unable to delete agent configuration because it is currently scheduled.

Version 9

    Verified Product Versions

    Endpoint Manager 9.6Endpoint Manager 2016.x

    Environment

     

    This should work in LDMS 9.5 and 9.6. It is assumed you are running MS SQL and have something like SQL Server Management Studio to run queries.

     

     

    Problem

     

    When trying to delete an Agent Configuration, a warning occurs indicating it is currently scheduled. The Agent Configuration is unable to be deleted.

     

    1-error.png

    Old LDMS Agent can't be deleted because it is currently scheduled.
       

     

     

    Cause

     

    The Agent Configuration exists as part of a scheduled task. While it is associated with a scheduled task, it will be locked and unable to be deleted.

     

     

    Solution / Workaround

     

    Locate the Scheduled Task and delete it.

     

    If you are unable to locate the Scheduled Task that is associated with the Agent Configuration, the following SQL Query can be ran to get a list of Scheduled Tasks that are utilizing the Agent Configuration. Once the Scheduled Tasks are identified, they can be deleted to release the lock on the Agent Configuration.

     

    Query to show all Scheduled Tasks that correspond with an Agent Configuration

     

    select t.ld_task_idn, t.task_name,tc.ld_Task_config_idn,tc.cfg_name, cc.Name
    from LD_TASK t
        join LD_TASK_CONFIG tc
            on t.LD_TASK_CONFIG_IDN = tc.LD_TASK_CONFIG_IDN
        join ClientConfig cc
            on tc.CFG_NAME = 'AgentConfig ' + CAST(ClientConfig_idn as nvarchar)
       

     

     

    Query to find Scheduled Tasks for a specific Agent Configuration. In this query replace <INSERT AGENT CONFIG NAME HERE> with the name of the Agent Configuration in desired.

     

    select t.ld_task_idn, t.task_name,tc.ld_Task_config_idn,tc.cfg_name, cc.Name
    from LD_TASK t
        join LD_TASK_CONFIG tc
            on t.LD_TASK_CONFIG_IDN = tc.LD_TASK_CONFIG_IDN
        join ClientConfig cc
            on tc.CFG_NAME = 'AgentConfig ' + CAST(ClientConfig_idn as nvarchar)
    where tc.cfg_name like
    (
        select '%' + CAST(ClientConfig_idn as varchar) + '%'
        from ClientConfig
        where name like '%<INSERT AGENT CONFIG NAME HERE>%'
    )
       

     

    Example: This example shows the query looking for any Scheduled Tasks for our 'Old LDMS Agent' configuration, and shows it is in use by the Scheduled Task called 'Deploy the 2007 Agent'.

     

    2-results.png