web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Unanswered

PAD queries

(0) ShareShare
ReportReport
Posted on by 391

Hi everyone,

 

I've a onboarding flow where it runs PowerShell script for creating on-prem exchange account and populates the fields in Active Directory. It works fine but the moment the onboarding flow is triggered at the same time or within a time frame of e.g ~10 seconds by another person, the first account will not be populated in Active Directory such as their AD groups are not being assigned.

 

I suspect that the first flow got booted off while it is still running when another person triggered the same flow? Strange thing is that the cloud flow run history is marking them as successful. So I can't really tell what went wrong.

Also, another strange behavior is that sometimes it WORKS even two flows are being triggered at the same time. So it is happening intermittently. 

 

My question is, if the first flow is still running and the same flow got triggered by another user within, say ~10 seconds. Does PA or PAD wait the first flow to finish before executing the another flow?

 

 

  • nicklim Profile Picture
    391 on at

    It seems to be working fine now after I added some conditions. Did a couple of tests and it is so far so good.

     

    Anyone know if the new action "Work queues" can be used in my scenario too?

     

    nicklim_1-1692237137229.png

     

     

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    To answer your questions:

    • PAD does not support parallel execution of flows on a single machine instance. So, yes - if there is a flow already running in PAD, the other flows that should run on the same machine will wait for the first one to complete. They will be queued and will only start when the machine is available. There is no such thing as a flow "booting" another flow automatically. You can cancel a flow manually or via a web service request to PA, but you'd need to build that into your flow. It cannot happen on its own.
    • Yes, work queues can be used for your case.

    As to the reason why this was happening, it is likely because when you did not have those conditions in place, you were likely overwriting/clearing some files that are relevant for all instances of the flows, and not just the current case. Make sure you have some dynamic file/folder naming in there, so that one case does not overwrite another one. You can then pass those file/folder names as input variables form the cloud flow to the desktop flow, so that your desktop flow "knows" which item to process. You can also use that as the contents of your work queue item, if you end up using that.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nicklim Profile Picture
    391 on at

    @Agnius 

     

    I think that is exactly what I got but it is still causing problems before I set the conditions. Also, based on your description and if I understand correctly, I shouldn't need those conditions or work queues action in PAD for the flow to run smoothly?

     

    Cloud flow

    nicklim_3-1692245946381.png

     

    PAD - Input variables

    nicklim_1-1692245824183.png

     

    PowerShell script

    nicklim_2-1692245863790.png

     

     

    Thanks for your time.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    What I can see from your desktop flow is that you have some static folder that you retrieve files from and then you empty it. And a file called "Running.txt" that you write to. Since I can see you wait for that file, I assume you create it elsewhere - either in the cloud flow or by triggering some sort of an external action that creates this file. This can likely cause the issue, if a new instance of the cloud flow can cause this file to be written to before the previous instance has used it.

     

    Also, since the file is in the same folder that you clear with Empty folder, this could also cause issues if your file for a new instance is in fact created before the first flow is complete, as the first flow might delete it by clearing the folder.

     

    That is why I suggest not using static folders and file names, and instead using dynamic values there.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nicklim Profile Picture
    391 on at

    @Agnius 

     

    Ah sorry I think there might be a miscommunication here.

     

    Initially my PAD flow is just the Power Shell script action itself without the conditions. It is running fine but sometimes it loses itself if the flow is being triggered within a short time frame ~10 seconds while the first flow is still running.

     

    It looks like this:

    nicklim_1-1692248293655.png

     

     

    So I did a test by adding those conditions (refer to the 2nd post) and ran it multiple times to see if the issue is still occurring. The result was promising as it is working.

     

    I just can't understand why is my initial setup not working correctly if PAD will wait for the active flow to complete before executing the other flow on the same machine? 

     

  • nicklim Profile Picture
    391 on at

    @Agnius 

     

    Also, I forgot to mention this. As for the Running.txt , I used the action to create the text file and passing empty value to it just for the purpose of creating the text file via PAD.

    Sorry for the confusion.

  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Can you share your PowerShell script? Is there any chance that one instance of the same script could affect another instance in any way?

    Also, have you checked the Monitor > Desktop flow runs section of your cloud portal to see the individual desktop flow runs and their details? You should be able to see what happened there. Also, I would suggest enabling the %ScriptError% variable in the Run PowerShell script action to be able to see if the script throws an error. PAD does not error out on a script error. But you can add a solution to throw an error in PAD if the script returns an error.

    -------------------------------------------------------------------------
    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.

  • nicklim Profile Picture
    391 on at

    @Agnius 

     

    Thanks for taking your time!

     

    I am afraid that I can't share the script as it contains a lot of my company details and it will be a hassle for me to go through 2,800 of lines just to remove them lol.

     

    Nonetheless, it is working now without any issues after adding the conditions in PAD. Again, I really appreciate you taking your time!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 424

#2
11manish Profile Picture

11manish 328 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard