Kaseya Community

Causing an Agent Procedure to fail

  • I have read a few posters in the past complaining that they run an Agent Procedure and the procedure says it is successful but it actually was not successful, as the intended task did not occur.

    Back when I was using Kaseya 5.1 I use to force the script to fail when a check on a log file shows that the script failed to do the task I needed it to do by adding an Agent Procedure Log entry and a Pause with no time specified immediately after the log entry so that I would know that the intended task failed. In Kaseya 6.x you get a syntax error which prevents you from doing this "Synthetic Failure" which mean you could no longer use this method.

    I few months back I had the need for a step that could cause the agent procedure to fail so I came up with this:

    So from the screen shot you see that you create a variable using the "Get Variable" step and then specify File Content and an invalid file path of "ERROR". This forces the Agent Procedure to fail after your Agent Procedure log entry.

    There might be other ways to do the same thing however this is what I came up with, hope it is of some use.

     

     

  • Capture.JPG

    Sorry if you can't see the screen shot the editor is not allowing me to edit my post Sad

  • Good point - and thanks for the tip.  I have given up on the statuses in Kaseya and pass back a comma delimited text file with the return status of the procedures that is then loaded into a table to report on.  Being able to both fail out a procedure and report back a reason code is extremely important IMO.

  • THANK YOU!  I spent a couple hours this afternoon just trying to figure out how to get my script to fail when it really didn't do what it was supposed to do.  Putting your synthetic fail in the ELSE worked like a charm.  Synthetic fail should be a standard option in the list of choices!

  • I think in 5.1 you could also us an "Execute Script" command to execute the same script and that would cause the script to fail when you want it to.

    I'm not sure if this works in 6 still.