2 Replies Latest reply on Oct 11, 2010 3:55 PM by jradziszewski

    Create SQL Script to start a scheduled task

    Rookie

      Hi all,

       

      I am creating a tool to autocreate a LND Task, add computers but now i want to add an option to be able to  start the task.

      I tryed the following SQL query:

       

      "UPDATE LD_Task SET Task_Status='1' WHERE LD_TASK_IDN=[TaskIDN]"

       

      This does update the taks status but it doesn't start the task on the computer the status of the computers stay's on waiting.

      What do i need to do to also start the task on the computer?

       

      Thanks in advance

        • 1. Re: Create SQL Script to start a scheduled task
          Catalysttgj Expert

          I think you're going to need to push SchedQuery.exe or one of the other Sched*.exe apps on the core to get what you're after.

          Before they introduced a way to control the frequency of how often policies would refresh (think pre 8.7 + some service pack), I made myself a little winbatch script that would push SchedQuery to get all the policies targeting freshly added/imaged computers. My script caused all tasks to refresh. You may only want the one task to refresh. You'll have to research the Sched*.exe command(s) switches to determine if this is even possible. I think it is, but i can't find the code to the script i made right now to tell for sure.

          Hopefully this alone is enough information to get you in the right direction provided it works obviously.

           

          Good luck!

          • 2. Re: Create SQL Script to start a scheduled task
            SupportEmployee

            The schedqry switch to resolve one task is: /policy=[ID]

             

            where 'ID' is the task ID

             

            e.g.

             

            schedqry.exe /policy=555