Happy new year, everybody!
Today I am sharing a cool trick that you can use inside the Automate Scripting Engine to prevent scripts from running if the current time falls between a window that you set. This example can be run on any agent. This can be useful in situations where you say don’t want a piece of software to install outside of business hours, or you have a script looking at performance and you only want it to trigger in business hours. If you just want the script, it’s attached at the end. If you want to see the steps, they are as follows:
Select the time period you want to control in the parameters. This step will return a 1 in to the variable name BetweenTimeBoolean if it’s between the set time period, else it will return 0
We are saying here that if the Boolean we set in Step 1 is 1, then jump to the label :ContinueInTimeWindow
Step 3 will exit the script, note this step will never be hit if Step 2 is 1
This is a script label, we are jumping here from Step 2 if we’re between the time Window. Anything underneath this will run as normal.
Or if you wish to download the XML to Import the Script
The script will import in to a folder called __Examples in your scripts folders.