Kaseya Community

Schedule Agent Procedure to run (from within another procedure) "Tonight"

This question is answered

Hey Folks,

Struggling a bit with something here and hoping to call upon the collective wisdom of the forums to assist me. I filed a ticket with Kaseya Support and was told this wasn't possible within the core VSA functionality, it has been submitted as a feature request, as well.

What I am looking to do is this:

  • When a specific trigger occurs (monitoring, alert, whatever) I want to have a procedure automatically scheduled to run "at 11:45PM tonight."
  • I want to run *Kaseya* procedures, so the Windows Task Scheduler or the Windows "at" command won't work for my purposes.

One theory I've seen says "calculate the 24-hour time and subtract it from the desired reboot time, store as variable, use within "schedule procedure" step for X minutes from now." Even with that, however, I'm not certain what the best way is to calculate the time and store it in such a fashion that it would allow me to do those calculations.

I've searched the forums a bit for "schedule procedure tonight" and that, of course, has not been super-useful. Curious to hear what others might be doing to effect this functionality.

Thanks...

Kerry



formatting problems - bullets don't work?
[edited by: Kerry D at 12:17 PM (GMT -7) on Jun 27, 2013]
Verified Answer
  • community.kaseya.com/.../52642.aspx

    I responded to somebody a few years ago about a similar question and I have used the same method to build some very powerful agent procedures that are accurate to within 1min its all about the math though.

    So if you know when you want to re/schedule the agent procedure you need to workout what the current time is using the WMI Win32_LocalTime values and then calculate the time in minutes when you want your script to run.

All Replies
  • I wrote my own utility to use on our Kaseya server for this exact task. It is freely available for anyone to use.

  • community.kaseya.com/.../52642.aspx

    I responded to somebody a few years ago about a similar question and I have used the same method to build some very powerful agent procedures that are accurate to within 1min its all about the math though.

    So if you know when you want to re/schedule the agent procedure you need to workout what the current time is using the WMI Win32_LocalTime values and then calculate the time in minutes when you want your script to run.

  • This is great - thank you. Now... what about Mac OS X/ Linux? :)

    Cheers,

    Kerry



    taggin'
    [edited by: Kerry D at 8:56 PM (GMT -7) on Jul 1, 2013]
  • Nope sorry I don't get to work much with other platforms unless somebody needs something that they can't figure out.

    From what I recall bash is okay for scripting with time and if that does not work your next best bet would by something like Python.

    Hopefully once we get LUA to use in Agent Procedures this type of thing will become easier.

  • I've got a script that when run will firstly determine the current time , then if its a Sat/Sun and then if it's a public holiday .

    It then takes as arguments the Start and End times of your normal business hours and from all the info provided will calculate in minutes when the start of the next business day is.