Photo by Mateusz Dach from Pexels

This time round I’m going to delve into Power Automate Desktop. Power Automate Desktop is an application you install on a local machine that extends Power Automate to allow you to perform activities on a local machine as part of a flow. It’s a service that used to require an extra subscription cost, but it’s now available to everyone included with whatever tier of Power Automate you currently have.

What Can You Do With Power Automate Desktop?

So the big question is what can you do with Power Automate Desktop? And the answer is, quite a bit. Among the things you can do:

  • Launch and interact with desktop applications
  • Manipulate files in all kinds of ways
  • Record and replay desktop and web actions
  • Interact with the local system in a myriad number of ways such as running scripts, starting/stopping processes, printing documents, restarting the computer and so forth
  • Interact with Office documents and the clipboard
  • Send keyboard and mouse commands
  • Manipulate text
  • Use OCR to pull text from images
  • Connect to and manipulate Azure and AWS services
  • FTP interactions

That’s just some highlights. There’s quite a bit more that you can do.

What Can’t You Do With Power Automate Desktop?

Power Automate Desktop does have limitations. But before we talk about that, you first need to understand how desktop flows are triggered. And you also need to understand the difference between unattended and attended modes.

Triggers

There are two ways to run desktop flows. The first is manually from the desktop. When you are logged in and Power Automate Desktop is running, you will see a little icon in the task tray to let you open the app. From there you can kick off any flow manually from the app.

Second, you can trigger the flow from Power Automate in the cloud. There is a Power Automate Desktop action that will let you pick a local machine and flow to run the same as you would any other flow action.

The one thing you can’t do is have an automated trigger on the local machine. The one thing Power Automate Desktop is missing is that capability to be able to set up local event triggers like: When I save an image file to the pictures folder, copy it to another folder.

It would be fantastic if things like that were an option, but alas not at present.

This leads us into the next concern:

Attended vs Unattended

There are two modes in which a desktop flow can be triggered. The first is unattended mode. Unattended mode is when no one at all is logged in to the machine on which the flow is to be triggered.

In this case, when the flow is triggered, Power Automate Desktop will create and manage the user session, run the flow, then log the user out. The flow runs with the screen locked so anyone physically near the machine won’t see the what is running.

But there are some gotchas. First, no one can be logged in. Period. Meaning no users at all are logged in. If someone is logged in, but it isn’t the user the flow is set to run under, the flow will fail.

If anyone is logged in, but their session is locked (i.e. they lock the computer and walk away), the flow will fail. If the user the flow is set to run under is logged in and working, then the flow can be run in attended mode (more on that in a second).

Windows 10 desktop version cannot run multiple flows at the same time. If one flow is already running and another one tries to trigger, it will queue up additional flows based on priority and time requested.

Windows Server can run multiple flows at the same time so long as each flow is set to run under a different user and all users involved have rights to access the machine. So long as no one is logged in (same as above), then Power Automate will run as many concurrent flows as your server has ability to sign in concurrent users (based on setup and Windows Server licensing). However, you must set these “parallel” flows to run as different users ahead of time. If they’re all set to run as the same user, then they will queue up to run in sequence, just as above.

In all of these cases, if someone “real” tries to log in while Power Automate is running a flow, it can disrupt the flow and error out. So most of the time, you’ll want to be sure the machine running your local flows isn’t one used by people for anything else—at least at the present time.

The other mode is attended mode. To run a flow in attended mode, the user being used to run the flow must already be logged in with an active session and the session cannot be locked. If the user is not logged in or the session is locked, the flow will fail.

If a flow runs in attended mode, it is generally advisable to sit back, relax, and let the flow do its thing. Interacting with the machine while the flow is running can potentially interfere with the run of the flow and cause it to fail.

Creating a Desktop Flow

So lets walk through creating a simple desktop flow and trigger it. I won’t walk through the setup process in detail. You can read more about that here: https://docs.microsoft.com/en-us/power-automate/desktop-flows/setup

The short version is you need to install three things:

  • Power Automate Desktop app – This runs the flows
  • Browser extensions – This allows you to interact with web apps and is available for Edge, Chrome and Firefox
  • On-premises gateway – This allows Power Automate in the cloud to trigger desktop flows on that machine.

Once you have that, creating a flow is easy. First, you’ll launch the Power Automate Desktop application and select “New flow”. Enter a name for the flow and click “Create”.

Power Automate Desktop - Start New Flow

You’ll be greeted with the desktop flow designer screen. Everything is drag & drop. Along the left side you’ll see the list of available actions. Simply select an action and drag it onto the design surface. It will be automatically added to the flow.

Power Automate Desktop - Flow Designer Interface

You can run and test your flow from the designer. It even provides you the ability to run from a particular step so you don’t have to run the entire flow every time during testing and development. On the right side there are various elements for defining variables, UI elements to interact with and so forth.

That’s the basics of the designer. An in depth look at the desktop flow designer is a discussion for another day. For today’s post, there’s just one more element we need to know about. Once we’ve created our desktop flow, how do we call it from Power Automate?

Calling a Desktop Flow

Once you’ve gone through the initial setup and created a desktop flow, we next need to know how to call our flow. It’s pretty simple. Power Automate has a category of actions named “Desktop flows”. For a simple example, I’ve created a flow using a manual button trigger. Below the trigger, select “New step”, and in the search box type desktop. You’ll see “Desktop flows” in the connector list, and one of the first actions you see should be called “Run a flow built with Power Automate Desktop”.

Power Automate - Add desktop flow action

If this is your first time adding a desktop flow connection, you’ll be asked to provide setup information. As part of the setup you added above, you should have installed the on-premises gateway. Here you’ll need to provide credentials to establish the connection. This is a step a lot of people get wrong. You do not use your domain credentials here. You need to have a local admin account that was set up on the machine with the gateway. Use those credentials.

Power Automate - Providing credentials for gateway

Once the connection is established, you’ll then see a selector for choosing your desktop flow. Again, you’ll need to make sure that both the desktop flow and the cloud flow were created in the same environment. If you have done so, you should see the desktop flow in the dropdown list. Select the flow, and then choose the Run Mode (attended or unattended). As discussed previously, you will almost always want unattended.

Power Automate - Select your desktop flow

And that’s it. Save your flow and run it. Remember to not be logged in to the local machine if you’re running as unattended.

Use Cases & Conclusion

So what are some good use cases for Power Automate Desktop at present?

  • When you have a legacy process that can be automated, but can’t yet move into the cloud. For instance, maybe it’s part of someone’s job to run a set of batch files each day.
  • When you need to manipulate files on the local network in a certain way on a regular basis. For instance, maybe someone scans in invoices to a folder and you want a process to pick up the files, OCR them and move them into a done folder
  • Automate the printing of documents to a local printer. Perhaps someone is creating a bunch of invoices to be mailed each day and you want a process set up to print off all the generated invoices each night to be stuffed and mailed the next day.
  • Automating interaction with a legacy mainframe or system. You can automate interactions with old mainframe terminals, including reading the text, sending commands and so forth.

Basically, any time you need to automate doing something on your local network that can’t be done from the internet, then Power Automate Desktop could be a good solution. And any of us who have been around for more than a couple of years knows that there are plenty of legacy apps and processes in just about any company where this might be a good solution.

In most cases, you’ll want to use a machine no one else is using or will be logged in to in order to run your Power Automate Desktop flows. Even setting up a VM somewhere, so long as it is accessible, would work well.

It is my hope that they will overcome the limitations at some point to make it more useful on machines in active use, but I guess we’ll see what happens.

About the author

Barret is a coder, gamer, father, husband, developer, manager, model railroader, writer, blogger, Browns fan, Buckeyes fan