Kaseya Community

Compare or evaluate time in script

  • I'm working on some monitoring tricks.

    In a script, I get the alert time using #at#. An example value is:
    5:11:39 pm 13-Oct-09

    I need to somehow compare this time to see if it is after 10pm but before 6am. I cannot find a way using the available function (check variable, evaluate expression, etc) to perform this task. Any ideas?

    Oh yeah, I don't have to use alert time, i could use the current system time if it's in an easier to evaluate format, I just don't know what the Kaseya global variable for current time is.

    Legacy Forum Name: Compare or evaluate time in script,
    Legacy Posted By Username: boostmr2
  • Since it appears there is no way to do this, I'm going to dev a vbscript for it. Basically have the KScript run a vbscript, passing it the alert time. vbscript will use the split function on time to get the hour value and am/pm value of the alert. Make some function to determine if it's between X hour and X hour, and return true/false to the KScript (or write to file and have KScript read it). Delete files for cleanup, then send email based on the true/false statement. This gives us the options to alert on monitor sets based on time, which is currently missing in Kaseya.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: boostmr2
  • This sounds like an interesting idea. If you get it working let us know. I have some scripts that I'd rather not run during the day but somehow get backed up for one reason or another.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: kroberts210