Power Automate Desktop Flows and Robotic Process Automation
Cloud flows automate tasks between connected services through APIs. But many business systems are old — they have no API, no connector, no web service. They are just windows on a screen that humans operate manually. Desktop flows let Power Automate control a computer the same way a human does — moving the mouse, clicking buttons, typing text, reading what appears on the screen — and automate those systems without any code or API integration. This capability is called Robotic Process Automation, or RPA.
What RPA Solves
Every organization has at least one system that nobody can replace — an old ERP, a government portal, a legacy database with a custom interface — that forces employees to manually copy data from one place to another. This manual work is slow, error-prone, and soul-crushing. RPA replaces the human at the keyboard with a software robot that does the same clicks and keystrokes, faster and without mistakes.
TYPICAL RPA SCENARIO Human does this every morning (1 hour of work): 1. Open the old ERP system 2. Log in with username and password 3. Navigate to Reports → Daily Sales 4. Export to Excel 5. Open the Excel file 6. Copy the totals 7. Open the internal dashboard web app 8. Log in 9. Paste totals into the right fields 10. Click Save 11. Close both applications Desktop Flow does this in 3 minutes, triggered automatically at 7 AM, while the employee has coffee.
Power Automate Desktop: The Tool for Desktop Flows
Power Automate Desktop (PAD) is a free Windows application that you install on the machine where the automation will run. It has a visual designer where you build desktop flows using drag-and-drop actions — no coding needed for most tasks, though it also supports Python and custom scripts for advanced use.
Installing Power Automate Desktop
Download Power Automate Desktop from powerautomate.microsoft.com/desktop-flows or from the Microsoft Store. Sign in with your Microsoft account. The application connects to your Power Platform environment automatically. You can also install it from within Power Automate web at make.powerautomate.com by clicking My Flows → Desktop flows → Install Power Automate Desktop.
The PAD Interface
POWER AUTOMATE DESKTOP LAYOUT ┌────────────────────────────────────────────────────────────────────┐ │ File Edit Actions Tools Help [Run] [Stop] [Record] │ ├──────────────────┬─────────────────────────────┬───────────────────┤ │ ACTIONS PANEL │ FLOW DESIGNER │ VARIABLES PANEL │ │ │ │ │ │ Search actions │ 1. Launch application │ Input Variables │ │ ▼ UI Automation │ 2. Click UI element │ Username │ │ Click element │ 3. Set text on field │ Password │ │ Get text │ 4. Get value from field │ │ │ Set text │ 5. Click Save button │ Output Variables │ │ Select item │ 6. Close application │ ExtractedTotal │ │ ▼ Web Automation │ │ │ │ Launch browser │ │ Flow Variables │ │ Navigate URL │ │ CurrentDate │ │ Fill form │ │ LoopCounter │ │ ▼ Excel │ │ │ │ Launch Excel │ │ │ │ Read from cell │ │ │ │ Write to cell │ │ │ └──────────────────┴─────────────────────────────┴───────────────────┘
Recording a Desktop Flow
The fastest way to build a desktop flow is to record your own actions. Power Automate Desktop watches what you do and converts each click, keystroke, and navigation into flow actions automatically.
How to Record
Click Record in the PAD toolbar. A small recording toolbar appears on your screen. Perform the task exactly as you normally would — open the application, click the menu, enter data, click Save. When finished, click Stop recording. PAD generates a complete flow with one action per step you performed. Review the generated flow, clean up any unnecessary steps, and run it to verify it works.
Recording Tips
Recordings capture the exact UI elements you interacted with. Rename each recorded action immediately after recording — "Click element on window" becomes "Click Daily Sales Report link." This makes flows readable when you come back to them weeks later. After recording, replace any hardcoded values (like dates or file names) with variables — so the flow works every time it runs, not just for the exact day you recorded it.
Key Action Categories in Power Automate Desktop
UI Automation: Controlling Windows Applications
WINDOWS APP AUTOMATION ACTIONS Launch application: Application path: C:\Program Files\LegacyERP\erp.exe Wait for it to load: Yes (waits until window is ready) Click UI element: Identifies the button/link by its window name, control ID, or coordinates Waits for element to appear before clicking Set text on text field: UI element: [Username field] Text to set: %Username% (use variable, not hardcoded text) Get details of UI element: UI element: [Total Sales field] Attribute: Value Stores result in: %ExtractedTotal% Select item from dropdown: UI element: [Report Type dropdown] Item: Daily Sales
Web Automation: Controlling Browsers
WEB AUTOMATION ACTIONS Launch new Chrome/Edge: URL: https://internal-dashboard.company.com Wait for page to load: Yes Navigate to URL: URL: https://internal-dashboard.company.com/reports Get web page element value: Web page: (the launched browser) UI element: (click to select the element on the page) Get: Text / Value / Href / Class Fill text field: Web page element: [Username input field] Text: %ServiceAccountUser% Click link / button on web page: Web page element: [Login button]
Excel Automation
EXCEL ACTIONS Launch Excel: Document path: C:\Reports\DailySales.xlsx or from a variable: %DownloadedFilePath% Read from Excel worksheet: Read: Cell value / Range / All used rows Write to Excel worksheet: Cell value or range Starts at: First available row, or specified cell Close Excel: Before closing: Save document Example: Read all rows from an Excel report and process each: Read all values from worksheet → stores as DataTable variable Loop through DataTable → For each row, extract columns
Conditionals and Loops in Desktop Flows
IF action (decide based on a variable):
IF %ExtractedTotal% > 100000 THEN
→ Send high-value alert email
ELSE
→ Log to standard report
END
FOR EACH action (loop through a list):
FOR EACH CurrentRow IN %ExcelData%
→ Write CurrentRow['Name'] to web form
→ Write CurrentRow['Amount'] to web form
→ Click Submit
END
LOOP WHILE action (repeat until condition):
LOOP WHILE %PageCount% <= %TotalPages%
→ Scrape current page data
→ Click Next Page
→ Increment %PageCount% by 1
END
Error Handling in Desktop Flows
ON ERROR action block:
Wraps any action that might fail
ON ERROR (click button fails):
CONTINUE flow execution
Set %ErrorOccurred% to True
After the risky section:
IF %ErrorOccurred% = True THEN
→ Log error details to text file
→ Send failure notification
END
Input and Output Variables: Connecting Desktop Flows to Cloud Flows
Desktop flows become far more powerful when they accept input from a cloud flow and return output back to it. This connection turns a standalone desktop automation into part of a larger end-to-end business process.
HYBRID FLOW ARCHITECTURE
Cloud Flow:
TRIGGER: Scheduled — every day at 7 AM
│
▼
ACTION: Run desktop flow
Input variables:
Username: [from Key Vault or environment variable]
Password: [from Key Vault]
ReportDate: formatDateTime(utcNow(), 'yyyy-MM-dd')
│
▼
(Desktop Flow runs on the target machine)
Logs in → Navigates → Downloads → Extracts totals
Returns: TodaySalesTotal, RegionBreakdown
│
▼
Cloud Flow continues:
ACTION: Condition — TodaySalesTotal > 500000
YES → Send priority alert to leadership
NO → Log to SharePoint, no alert
Defining Input Variables
In PAD, open the Variables panel and click the Input/Output tab. Click the plus button to add an input variable. Give it a name (Username), a type (Text), and mark it as Sensitive if it contains a password. The cloud flow's "Run a desktop flow" action then shows a field for each input variable you defined — fill them in with dynamic content or secure references.
Attended vs. Unattended Automation
ATTENDED vs. UNATTENDED ATTENDED RPA: ├── Human triggers the flow manually ├── Human is logged in and watching ├── Can interact during the run (fill a CAPTCHA, confirm an action) ├── Uses the user's own Windows session └── License: Power Automate Premium (per user) UNATTENDED RPA: ├── Triggered automatically (from cloud flow or schedule) ├── Runs without anyone watching — machine can be locked ├── Can run overnight or on weekends ├── Requires a dedicated Windows machine (or cloud VM) └── License: Power Automate Process license (per machine/bot) BEST PRACTICE: Start with attended flows to validate the automation works. Move to unattended for production after thorough testing.
Machine Groups: Scaling Desktop Automation
When one machine is not enough — your automation needs to run on multiple machines simultaneously for high-volume processing — Machine Groups let you pool several machines and distribute flow runs across them automatically.
MACHINE GROUP DIAGRAM
Cloud Flow triggers "Run desktop flow"
│
▼
Machine Group: ReportingBots
┌──────────┬──────────┬──────────┐
│ Machine1 │ Machine2 │ Machine3 │
│ (busy) │ (free) │ (busy) │
└──────────┴──────────┴──────────┘
│ assigns to Machine2
▼
Desktop flow runs on Machine2
(Machine1 and Machine3 continue their own runs)
Register machines in the PAD application by going to Machine → Machine groups and adding the current machine to a group. Create the group itself in the Power Platform Admin Center under Resources → Machines.
When to Use Desktop Flows vs. Cloud Flows
DECISION GUIDE
Does the target system have an API or Power Platform connector?
YES → Use a Cloud Flow (faster, more reliable, no machine needed)
NO ↓
Is the target system a Windows application or a website?
Windows app → Use Desktop Flow (UI Automation actions)
Website → Use Desktop Flow (Web Automation actions)
(or check if there is an HTTP connector first)
Does the automation need to run overnight without anyone watching?
YES → Use Unattended Desktop Flow (requires Process license + VM)
NO → Use Attended Desktop Flow (runs when user triggers it)
Key Points
- Desktop flows use RPA to control any Windows application or website by simulating mouse clicks, keystrokes, and screen reading — no API required.
- Power Automate Desktop (PAD) is the free Windows application for building desktop flows. Download it from Microsoft and sign in with your Microsoft account.
- Use the Recorder to capture your manual steps and auto-generate a flow — then replace hardcoded values with variables.
- Key action groups: UI Automation (Windows apps), Web Automation (browsers), Excel (spreadsheet operations), and Conditionals/Loops for logic.
- Input variables let cloud flows pass data into desktop flows. Output variables let desktop flows return results to the cloud flow for further processing.
- Attended RPA runs while a user is logged in and watching. Unattended RPA runs fully automatically on a locked machine overnight — requires a Process license.
- Machine Groups pool multiple machines and distribute concurrent desktop flow runs across them for high-volume automation.
