Kaseya Community

Ex- or include a specific time range for an agent procedure

This question is answered

Hi,

I found the checkbox "Exclude the following time range" when scheduling a procedure for any of my agents. I played around a bit but it won't work at all. For example i created a procedure checking a proccess running and sending an email if it's not but it sends me an email all the time - regardless of what i configured for the excluded time range.

 

Is there any way at all to exclude or include specific time ranges when the procedure should run?

Verified Answer
  • Procedure_Current_Time_(Template).zip

    I have seen one of the Kaseya Training team use a VBscript to calculate this but I prefer to use the WMI procedure variable option myself as vbscripts tends to get blocked by AV. Here is a link to what you would need to figure it out;

    msdn.microsoft.com/.../aa394114%28VS.85%29.aspx

     

    Also I have attached a sample I made using the WMI procedure variable with the Win32_LocalTime Class. You could also use the Win32_CurrentTime Class.  I have used this before to create a procedure to power down computers once the patch management is done but to skip if the event occurs within work hours, for this you would use the "DayOfWeek" and the "Hour" properties. When working with WMI in Kaseya I found learning how to use WMIC from the command prompt to be very useful to locate the properties you are looking for and to find out if they exist under all the OS version or not.

All Replies
  • Procedure_Current_Time_(Template).zip

    I have seen one of the Kaseya Training team use a VBscript to calculate this but I prefer to use the WMI procedure variable option myself as vbscripts tends to get blocked by AV. Here is a link to what you would need to figure it out;

    msdn.microsoft.com/.../aa394114%28VS.85%29.aspx

     

    Also I have attached a sample I made using the WMI procedure variable with the Win32_LocalTime Class. You could also use the Win32_CurrentTime Class.  I have used this before to create a procedure to power down computers once the patch management is done but to skip if the event occurs within work hours, for this you would use the "DayOfWeek" and the "Hour" properties. When working with WMI in Kaseya I found learning how to use WMIC from the command prompt to be very useful to locate the properties you are looking for and to find out if they exist under all the OS version or not.

  • Hi,

    thanks that sved my day.

    For some reason i had to rescript it, because when I imported the script it would'nt work. After rescripting it did it's job.

    Thanks

  • Know this was a long time ago but great script.

    Do you know if there' s a way to get the K Server time? I'd like to create a script that compares the 2.

  • Can be either the KServer time or just the true time pulled from a website.

  • @etabush Why would you need to do this? The reason I ask is because there might be a better way to do what you asking to do. If you are simply trying to make sure that the remote machine's clock is accurate then you could simply set an NTP server, restart the time service and make it resync to update the time.