Hello, We have a task which checks every hour if jobs have been added to a list (CSV-File) and if so will start provisioning tasks including Microsoft Teams.

If there are many entries it could take more than an hour (especially the microsoft teams task may take a while) and the the next run of the scheduled task starts to run.

It would be great if we could add a condition or check withing the script, if the previous job has completed or is still running to prevent duplicate runs. Is this somehow possible?

ago by (20 points)

1 Answer

ago by (306k points)
0 votes

Hello,

Sorry for the confusion, but we are not sure what exactly makes you think a scheduled task run starts while the previous one is still in action. It is generally impossible as the next run time is calculated from the moment the previous run ends, not from the time it begins.

ago by (20 points)
0

Hm that's good to know. So it may have been a human error.. . I'm quite sure i had the situation, that the script was starting even it was running already. Could it be that if i start the task manually with "Run Now", that it does not update the schedule?

ago by (306k points)
0

Hello,

I'm quite sure i had the situation, that the script was starting even it was running already.

A script running and a scheduled task running are totally separate and unrelated things. For example, if your scheduled task runs a script that initiates an external process, the scheduled task execution will be completed within a few seconds, but the external process will keep running. If that is your case, you need to use a script condition in the task. The condition should check the external process status and be met only if the process is not running.

Could it be that if i start the task manually with "Run Now", that it does not update the schedule?

No, you can see that by viewing the Next run property of the scheduled task.

Related questions

Is there a way to have a Scheduled Task with 4 different condition? I want to create a scheduled task start every Monday and the condition see: The next Saturday of the week ... of the week is the fifth of the month then no action Thanks in advance, Simone

asked Jan 18, 2022 by Simone.Vailati (500 points)
0 votes
1 answer

For creating a computer object, we want to check if the entered CN is already used in our AD. And for that we want to use a powershell script. An other dot ... powershell script should be start before creating the computer object, right? Thanks for your help.

asked Jun 4, 2024 by KEME (100 points)
0 votes
1 answer

I'm trying to run a powershell script that triggers before updating a user, but only run it if the action comes from the self-update web interface. Is that possible?

asked Sep 4 by jaymallery (40 points)
0 votes
1 answer

I am trying to trigger processing outside of Active Directory when an account is created based on the source user account that was used. Does Adaxes store the source account anywhere?

asked Oct 9, 2023 by jnordell (20 points)
0 votes
1 answer

I have a dropdown-field on the web surface, which is populated by a script. The script looks up all groups in a specific OU and displays them. In the Property Pattern ... random order. What should i do to show the groups in alphabetical order in the portal?

asked Sep 15, 2020 by lohnag (160 points)
0 votes
1 answer