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 Platform Community / Forums / Power Automate / Improve Performance of...
Power Automate
Unanswered

Improve Performance of a Desktop Flow

(0) ShareShare
ReportReport
Posted on by 115

Hello Everyone.

 

I had previously created a cloud flow. Now I am making the same flow in Power Automate Desktop.

 

In the cloud flow I had used compose actions and for apply to each loop I was using concurrency.

 

So, is concurrency available in PAD?

 

If not can you guys suggest some techniques by which I can increase performance of my flow.

 

Or could I try this: Run that same flow on different machines, so that I can process more files at the same time?

 

And is there any logging feature in PAD? In cloud flows I used to use result function, to get inputs and outputs for a particular action. And then store it in a database. In PAD is there a way to do that? And also log errors.

 

Thanks.

 

@VJR 

@Henrik_M 

@MichaelAnnis 

@Ankesh_49 

@ryule 

@Pstork1 

@ScottShearer 

@Expiscornovus 

 

I have the same question (0)
  • Pstork1 Profile Picture
    69,629 Most Valuable Professional on at

    Why are you trying to recreate a cloud flow as a desktop flow?  In general desktop flows are used when there isn't an available connector or you need to go through the user interface.  A desktop flow is always going to be a bit slower than the same thing in a cloud flow.  Because you are going through the UI they are also a bit more fragile. I've recreated cloud flows for clients that were originally done as desktop flows, but I've never done it the other way around.

     

    1) I am not aware of a way to make loops in Power Automate Desktop run concurrently. Since they interact with the UI this would be very difficult to accomplish.

    2) Running the flow on multiple machines is possible, but that requires licensing for unattended RPA.

    3) For handling errors each desktop action has an advanced section where you can specify what to do in the case of errors. There is nothing I've found like results(), but you can definitely record a text log on the machine when errors occur.  This learning module will walk you through the error handling capabilities in PAD. Configure exception and error handling in Power Automate for desktop - Training | Microsoft Learn

  • Unknown123 Profile Picture
    115 on at

    @Pstork1 

     

    I am creating the desktop flow because the files I want to process can't be uploaded to the cloud. They are available on the legacy server or on premise database. 

     

    Before we were planning to upload the files on blob storage, but the approach got rejected. So, making a desktop flow. 

  • Pstork1 Profile Picture
    69,629 Most Valuable Professional on at

    You can still access the files on an on-premises server using an on-premises gateway. But that requires a Premium license, so I understand the rationale of doing it on the desktop instead.  But the reality is that the desktop is going to be inherently slower and a bit more fragile because you are going through a UI instead of using an API.

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    I feel your pain @Unknown123 with compliance/security stepping into some of the scenarios 😉

     

    @Pstork1What you have suggested is essentially... copying file to the cloud and this can be an issue from legal/compliance/PII/other reason, especially for us in EU.

    And on-premises gateway is a well... direct gateway to the entire data plane so very often restricted.

     

    Error handling

    @Unknown123When you get familiar with PAD error handling possibilities you can really craft whatever you require.

    I usually use on block error in Main that covers all error that reach to the top level and then trigger sub flow dedicated to gracefully exiting the flow, logging etc.

    Then I use on error blocks in specific flows if i need to be sure it continue to operate when issue happens.

    Very often i enclose all actions in loops to handle errors happening in loop, so I update item status, log, and move to next loop.

    I also sometime use error handling on individual actions, set variable and move to label or sub flow.

     

    Logging

    I used to be logging additional info to txt file.

    In my Initialization flow i set the variable such as "logfile" then use write text to %logfile% whenever I want to store some diagnostics, I've seen people logging to excel instead but I prefer the simplicity of text file in this case.

     

    When it comes to concurrency - no love here, PAD can handle single job at the same time  🙂

     

    Performance wise:

    - I use SQL to excel whenever possible, instead of opening app and automating it

    - I almost never use Wait with fixed time - i use wait for X (UI element, text, whatever) to be sure I pause the flow the minimal required time.

    - I try offload work from PAD to whatever is possible, for example, I have couple of flows where i get data from Web app, and then instead of manipulating the data in PAD in loops, i past it to the excel template where i have a set of formulas doing the job in seconds, then if i need i use SQL to get data gain. Might sound counterproductive but it actually improved performance of those flows.

  • Pstork1 Profile Picture
    69,629 Most Valuable Professional on at

    I am not suggesting copying the file to the cloud. I pointed out that a cloud flow can work directly with files that are stored on-premises.  But my point was that a Desktop flow is never going to run as fast or as efficiently as a cloud flow.  This is reality based on how it works.

     

    Also, your comments about an on-premises gateway would suggest you don't really understand what on-premises gateways are or how they work.

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    Hi @Pstork1 

     

    I am not suggesting copying the file to the cloud. I pointed out that a cloud flow can work directly with files that are stored on-premises.

     

     

    My understanding is that when you use gateway to do operations on local file system, you are pulling data from local system to the cloud, e.g. if you read data from file, that data lands in cloud, even if for the time the flow executes (assuming you are not storing it anywhere, even i logs).

    That is prohibited for certain scenarios as this is basically data processing on the public cloud (data is collected on-premise, transferred to the cloud server, processes in the cloud).

    Processing data in US based servers is a no go for many scenarios, due to the law that allows US gov to obtain data, so if one is working on Environment outside of EU/EOG - he is roasted and very often needs to look for on-prem solutions.

    Welcome to the EU 🙂

     

  • Unknown123 Profile Picture
    115 on at

    @momlo @Pstork1 

    Thanks for the reply.

    Yes. Because of the security purposes, we cannot upload any data to cloud. 

     

    @momlo 

    Can you explain the log file part where you just store diagnostics? What is that?? Can you also share a SS if possible?

     

    For the logging part I was thinking, where ever I have an important action in my flow, I will be making an api call after that action. In the body of the api call, I will take the variable I am sending to the above action, which can be called as the input for that action and the output variable that will be coming from that action directly, I will send it as the output of the file. So, thats how I was thinking to log data. And for the errors, I will run a subflow to store the inputs and log it and end that iteration and send it to next iteration.

     

    Yea, I saw some videos regarding error handling and understood the concept.

     

    One more question for everyone. With machines, can I do this, lets say I have 50 files on 1st machine and 50 files on second and so on. And at the same time on all machines the flow runs and processing of all the files is done. This might improve the performance, if I am understanding the concept of machines right. 

     

    And is there parent and child flows in desktop flows? Probably was thinking to use same subflows for many other flows as we can just copy all the actions and paste it in other flow.

     

    And I read an article today, in which person had mentioned all the flow runs get stored in dataverse in flow sessions table. But when I opened that table, it was last modified last month. 

     

    I have no idea about the flows getting stored in dataverse. Can you guys share articles or videos regarding that?

     

    Thanks. 

  • Unknown123 Profile Picture
    115 on at

    @Pstork1 

    Actually the cloud flow had api calls. And by just the values coming from some api, I was calling some other api. There is no UI involved in the desktop flow, thats why it was pretty easy to convert that cloud flow to a desktop flow. 

     

    For the logging part, I have to log the input and output for all the important actions in my flow, not just the error part. Error part I will log separately. Both are done with separate API calls.

  • Pstork1 Profile Picture
    69,629 Most Valuable Professional on at

    Whether you use a cloud flow and a gateway or not, using Power Automate will involve running in the cloud.  Power Automate Desktop is still a web based application.  It does not guarantee that all processing takes place on the desktop.  So there really is no difference in that case between using PAD and using regular Power Automate.  If PAD worked completely on the desktop you would be able to run it while you were offline.  If you unplug your computer from the network I think you will find that PAD doesn't run.

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

     

     

    Can you explain the log file part where you just store diagnostics? What is that?? Can you also share a SS if possible?

     

     

     

    Simple example:

     

     

    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
    Text.ConvertDateTimeToText.FromDateTime DateTime: CurrentDateTime StandardFormat: Text.WellKnownDateTimeFormat.SortableDateTime Result=> FormattedDateTime
    Text.Replace Text: FormattedDateTime TextToFind: $''':''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''.''' ActivateEscapeSequences: False Result=> FormattedDateTime
    SET LogFile TO $'''C:\\Users\\SECRETUSER\\Desktop\\%FormattedDateTime%.log'''
    File.WriteText File: LogFile TextToWrite: $'''Flow Start: %CurrentDateTime%
    -----''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    File.WriteText File: LogFile TextToWrite: $'''Starting browser''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    WebAutomation.LaunchEdge.LaunchEdge Url: $'''mediamarkt.pl/rtv-i-telewizory/telewizory/wszystkie-telewizory?limit=50&page=1''' WindowState: WebAutomation.BrowserWindowState.Normal ClearCache: False ClearCookies: False WaitForPageToLoadTimeout: 60 Timeout: 60 BrowserInstance=> Browser
    ON ERROR REPEAT 1 TIMES WAIT 5
    END
    File.WriteText File: LogFile TextToWrite: $'''Browser started''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    File.WriteText File: LogFile TextToWrite: $'''Extractign data''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    WebAutomation.ExtractData.ExtractList BrowserInstance: Browser Control: $'''html > body > div:eq(0) > div:eq(1) > div:eq(3) > div > div > div:eq(5) > div:eq(1) > div:eq(2) > div:eq(0) > div''' ExtractionParameters: {[$'''div:eq(0) > div:eq(0) > div:eq(0) > div:eq(0) > a > h2''', $'''Own Text''', $''''''] } PostProcessData: False TimeoutInSeconds: 60 ExtractedData=> DataFromWebPage
    File.WriteText File: LogFile TextToWrite: $'''Starting loop''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    SET Counter TO 0
    LOOP FOREACH CurrentItem IN DataFromWebPage
    Variables.IncreaseVariable Value: Counter IncrementValue: 1
    File.WriteText File: LogFile TextToWrite: $'''Item no %Counter% out of %DataFromWebPage.RowsCount%: %CurrentItem%''' AppendNewLine: True IfFileExists: File.IfFileExists.Append Encoding: File.FileEncoding.Unicode
    END

     

     

     

     

    For the logging part I was thinking, where ever I have an important action in my flow, I will be making an api call after that action. In the body of the api call, I will take the variable I am sending to the above action, which can be called as the input for that action and the output variable that will be coming from that action directly, I will send it as the output of the file. So, thats how I was thinking to log data. And for the errors, I will run a subflow to store the inputs and log it and end that iteration and send it to next iteration.

     

     

     

    Sounds bit complicated but it really depends what you want to achieve, I store those logs to see some verbose info in case flows fail. But you can call api, store in DB, store in file, excel etc.

     

     

     

    One more question for everyone. With machines, can I do this, lets say I have 50 files on 1st machine and 50 files on second and so on. And at the same time on all machines the flow runs and processing of all the files is done. This might improve the performance, if I am understanding the concept of machines right.

     

     

     

    You can call another flow from within one flow but  it executes on the same machine, it is treated as any other action. So you would need to have those files on network share for example, then trigger X flows on X machine handling those files, just need to build the mechanism so they don't interfere with each other (such as 1 bot handles 1 file or locks the file so other don't grab it etc).

     

     

     

    And is there parent and child flows in desktop flows? Probably was thinking to use same subflows for many other flows as we can just copy all the actions and paste it in other flow.

     

     

    Yes, how I use this:

    1. I split individual Desktop Flows in Sub flows and treat each subflow kind of a function in programming - it does specific task it was created for.

    2. Then if I have a Subflow that I know i will be using in other flows, I save it as a separate Desktop flow, configure input pramateres etc.

    3. I call this Desktop flow from any other flow.

     

    Example for this is launching web browser or desktop app and logging in with credentials.

    Whenever logon process changes, you need to update this one desktop flow only and and other Desktop flows that call it will work as expected. Again, I am treating some of my flows as a functions that are called by other desktop flows.

    One issue with those is that they appear in Power Automate web as if they were any other flows/bots, so kind of clutter the logs, but If you name them like "Shared_Web_App_X_Logon" you see it is not the full bot, but shared one.

     

     

     

    And I read an article today, in which person had mentioned all the flow runs get stored in dataverse in flow sessions table. But when I opened that table, it was last modified last month.

     

     

    Flows that you trigger from Power Automate or console are stored in dataverse.

    Runs that you start in Designer do not store in dataverse.

    Having said that, remember that all variables (including your secret data if you read it from file/page etc into variable) are stored in logs and they land in the cloud. To prevent that mark variable as a sensitive variable - this will replace the actual value before it sends the log to the cloud.

    For the sake of making it habit, I mark all of my variables sensitive 😄

     

    https://learn.microsoft.com/en-us/power-automate/desktop-flows/manage-variables#sensitive-variables

     

     

     

    I have no idea about the flows getting stored in dataverse. Can you guys share articles or videos regarding that?

     

     

    Main issues I had to resolve when it comes to logs in the cloud:

     

    1. Use sensitive variables so secret data does not go to cloud

    2. When capturing app/web UI hide secret data behind the recording window - screenshot of the entire windows lands in cloud, so if you have sensitive data - it is an issue

    3. Power Automate flow logs are stored for 28 days, Power Automate Desktop logs are stored as long as the flow exists in the Environment - for this reason I have a cloud flows that runs each day and removes logs older than 14 days

     

    Edit:

     

    Forgot to add:

    When your desktop flow fail, it captures the screenshot of entire desktop and sends to the cloud.

    Again, if you had app or web opened with sensitive information - it lands in cloud.

    I manage this in my Main error handling:

    If something goes wrong and I cannot recover with error handlign in subflows or loops etc. main error handling calls a subflow names "CleanFail" 😄 where i ensure I close all of the apps, web pages, anything that can display sensitive information then I open empty notepad in full screen that covers entire desktop in case anything is still open that could be displaying any data.

     

     

    To sum this up - you can build flows that will limit the sensitive data leak from your on-prem to the minimum if not completely.

    Key points:
    - Sensitive variables

    - Secure Inputs/Outputs in PA and PAD

    - No sensitive data displayed in UI/Web or hidden behind record window so they don't get captured on screenshot

    - Error handling that manages failing flow, so it does not ends up unmanaged fail

     

    I hope this helps

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 272 Super User 2026 Season 2

#2
trice602 Profile Picture

trice602 147 Super User 2026 Season 2

#3
11manish Profile Picture

11manish 146 Super User 2026 Season 2

Last 30 days Overall leaderboard