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 (190 points)

1 Answer

0 votes
by (299k 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, 2024 by Moodie007 (70 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.5k points)
0 votes
1 answer

how to automatically grant a user's manager access to their network drive and onedrive during a user's deprovisioning. I don't want to manually grant access to the ... -prem file server and onedrive. Can this be incorporated in the user deprovisioning script?

asked Jan 28 by Fausat (20 points)
3,633 questions
3,321 answers
8,398 comments
548,760 users