Kaseya Community

How do I create a loop within a procedure?

This question is not answered

I have a step in a procedure where it checks for user activity. If there is no activity (I assume for 10 minutes prior?), the procedure will run a software upgrade. If there has been (last 10 minutes?) activity, the upgrade step will not run and the procedure ends.

Instead of just ending for the latter case, I want the procedure as a whole to keep looking for inactivity and when the system has been inactive long enough (not sure what length of time is required to meet the "inactive requirement of Kaseya"), I want the procedure to continue and run my upgrade.

How do I implement this?


All Replies
  • loops are not supported in Agent Procedures

    The agent is considered inactive after 10 min as per their documentation.

    You may want to do a check agent status, if not idle then schedule this procedure in 10 min.

  • Stephen,

    To expand on what Danrche said, you can jury-rig loops by rescheduling the procedure from within the procedure... So check for X.  If no X, reschedule the procedure to re-run after Y minutes.  When it re-runs, eventually the check for X will be true and do what you need.

    Remember that the Agent can only process one procedure at a time.  Having loops that wait would prevent any further procedures from executing.  By rescheduling, you let the agent go through the rest of the procedures that may be in the queue.

  • Also note that if the original script had variables passed to it e.g. from a Monitor Set , then these variables values will be lost when you reschedule the script

  • on a side bar.... I use the agent procedures more as a distribution and activation method to deliver vbscript or python apps to do what we need. As an example, write file to agent temp, and execute shell command are great to do this with. The idea is to use a REAL scripting engine to accomplish your task and just use Kaseya as a delivery and collection tool for it. This method ofcourse requires you to learn a scripting language, but it's much more powerful then what's offered by kaseya.

  • I agree with danrche. Basically, Kaseya is simply an advanced task scheduling service for me. I use either vbscript or powershell for my tasks and, as danrche says, just use Kaseya as a delivery/collection/monitor tool. Even at that, I'm so tired of Kaseya's cruddy support, cruddy gui, cruddy modules and cruddy concern for its paying customer's wants and needs that this is probably the last year I will be a VSA customer.