0 votes

I have a scheduled task that needs to run every 2 hours, but it must not run outside of office hours. Is there any way to achieve this?

by (170 points)

1 Answer

0 votes
by (289k points)
selected by
Best answer

Hello,

Unfortunately, there is no possibility to configure the schedule of a task in such a way. Howevr, thank you for the suggestion, we forwarded It to the corresponding department for consideration.

As of now, you can achieve the desired using the below script in a condition of your task. The script returns true only if the current hour does not match any of those specified in the $excludeHours variable.

$excludeHours = @(3, 10, 15) # TODO: modify me

# Get current date
$currentDate = [System.DateTime]::UtcNow

foreach ($excludeHour in $excludeHours)
{
    if ($excludeHour -eq $currentDate.Hour)
    {
        $Context.ConditionIsMet = $False
        return
    }
}

$Context.ConditionIsMet = $True

Related questions

0 votes
1 answer

It would be good to have a selectable column for the tasks schedule pane. This would allow us to easily show tasks scheduled dates and give us the ability to sort by the ... case it would be good to sort all of these password resets by their scheduled date.

asked Apr 30 by Moodie007 (60 points)
0 votes
1 answer

I would like to add "Configuration > Scheduled Tasks" to the Adaxes Web UI. I canĀ“t find an option to impelement this. Any hints?

asked Feb 9, 2021 by MatthiasP (40 points)
0 votes
1 answer

Is it possible to run a report to get users disabled in the last 24 hours?

asked Jun 10, 2020 by peggleg (110 points)
0 votes
1 answer

We're running version 3.9.15526.0 of Adaxes, and in the Web Interface when you try to edit the logon hours for the user, you can not select hours 9 and 10 individually. In ... top, and that does work. I confirmed that it doesn't work in either Chrome or IE.

asked Nov 28, 2018 by rurbaniak (1.4k points)
0 votes
1 answer

Is it possible during a custom command to prompt input from the user initiating the command and to take a different action depending on their answer? For example, ... provide the automatic reply text If No - proceed with predetermined reply text. Thanks

asked Oct 28 by msheppard (470 points)
3,549 questions
3,240 answers
8,232 comments
547,814 users