Kaseya Community

How can I purposely fail a script?

This question is answered

Hey guys,

I'm wondering how I can purposely get the return "Script Summary: Failed in step.." with a certain command. In my example, I want to check a registry key for a version of a program, if it's outdated I want it to return a fail. If it's up to the current version - a success.

 

Thanks,

Alan



[edited by: aabbasi at 9:57 AM (GMT -8) on 11-7-2011] typo
Verified Answer
  • Does the registry include the program version somewhere?

    If so I would put a Get Variable (that reg key), then an IF which checks the value of this key is say 4 or above, if it is then your script continues, if not, well just don't put anything in the ELSE and it will stop and exit, if you need to make it fail then tell it to write a procedure log entry which says #NON-EXISTENT-VARIABLE# then your script will fail as the above non-existent variable won't exist.

    Might I ask why though as I suspect there is better options than making it fail.

  • community.kaseya.com/.../65105.aspx

All Replies
  • Does the registry include the program version somewhere?

    If so I would put a Get Variable (that reg key), then an IF which checks the value of this key is say 4 or above, if it is then your script continues, if not, well just don't put anything in the ELSE and it will stop and exit, if you need to make it fail then tell it to write a procedure log entry which says #NON-EXISTENT-VARIABLE# then your script will fail as the above non-existent variable won't exist.

    Might I ask why though as I suspect there is better options than making it fail.

  • Thanks friend.

    It's just the quickest reply I can get from the server without cluttering my e-mail, as I just want to jump on the failed machine and check some possible bugs it may have due to an outdated Quicktime.

  • If possible I would look to have all the steps you are doing manually on the server in the ELSE steps of the scripts.

    For example I have a VSS Updator script which checks it's version equals XXXX, if it doesn't it updates it then emails us requesting a restart, if it does match it then it exits.

    But then I don't know what steps you need to do with QT, anyway food for thought.

  • community.kaseya.com/.../65105.aspx