cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

How to run a desktop flow from windows task scheduler

 

My Objective is to run the flow once when pc starts between 8 am till 10 am each day using the windows task scheduler.

flow.PNG

 

42 REPLIES 42
D_D_
Frequent Visitor

Hello,

 

It seems no solution since 02/2021 and Microsoft does not propose possibility.

Then, I checked how to do.

I found solution to launch Power Automate Desktop Flow w/o premium and w/o internet connection.
Solution is based via SendKeys. I know this is not ideal and dirty, but if somebody found a another better solution I open to use it.

When you open Power automate there are not possibility to launch flow trough keyboard shortcut.
But Power Designer can launch flow via F5 shortcut.
So target it to open flow with Power Dseigner and simulate F5 key.

But open a flow via Power Designer is quite difficult.

Solution I found: Open Power Automate then open flow in designer and check command line generated to study it and understand parameters send.
Use this command line in a VBS script and simulate 2 shortcuts:
1st = 'ESC' to validate Designer was not launch correctly
2nd = 'F5' to launch the flow itself.
this is it.

Let me know if it interesting and work for you.

 

 

 

' DD 13.06.2022
' Create a file 'xxx.vbs' with this code. 

' 2 steps to start Power Automate Desktop from command line w/o premium right
' I use Power Automate Designer to open flow and launch it
' Launch is via SendKeys. This is not perfect but better than nothing.
' Why use Designer to launch flow ? Because Designer can be use via keyboard (F5) to launch flow

' How to use:
' First open Power Automate Desktop and go in design mode of required flow/edit
' then uncomment lines codes below to know information regarding command line, launch this VBS and comment it again.
'ToKnowCommandLine

' This create a file on dekstop with informations regarding command line.
' Open this file and check command line. 
' Copy Paste command line below and modify '"' 
' 
CommandLine = "C:\Program Files (x86)\Power Automate Desktop\PAD.Designer.exe ms-powerautomate:/designer/flow/edit?clientsessionid=90edff13-81bb-4e27-8c22-adb83b1d2898&environmentid=Default-6cf18ffb-edc6-4d7d-9874-5c515ab0c6ae&environmentname=HelloWorld+(Upgrade)&environmentgeo=europe&environmentregion=westeurope&environmentcloud=tip0&crmorg=https%3a%2f%2forgd0fee972.api.crm4.dynamics.com&tip1=false&upn=sivod.d%helloworld.fr&workflowid=a3ad2ff9-abd1-4a2c-985b-ede972418b7b&createnew=false&processname=AAA_Essai&processInsightsContext=false&parentcorrelationid=c3ef9112-e1bc-4c8b-ae94-5987593793bf&tenantid=6cf18ffb-42c6efd7d-9874-5c515ab0c6ae&principaloid=df12fabc-641a-4fc6-baf8-55d0fdbe24f8&principaluid=100300ef9A704212"

processname=mid(CommandLine, instr(CommandLine, "processname=")+12, InStr(instr(CommandLine, "processname="),CommandLine, "&") - (instr(CommandLine, "processname=")+12))
Set oSh = CreateObject("WScript.Shell"): Set oFs = CreateObject("Scripting.FileSystemObject")
osh.run("taskkill /f /im PAD.Designer.exe"),0,1

oSh.Exec(CommandLine)
oSh.popup "Début. Flow Engine will start.",2,"PAD.Designer.exe " & processname,0

For F = 0 to 100
	wscript.sleep 100 
	if oSh.AppActivate(processname) = true then 
		oSh.popup "Step 1 in progress" & chr(10) & "Do not touch mouse or Keyboard" &_
		chr(10) & "Do not close this message",10,"PAD.Designer.exe " & processname,0
		oSh.AppActivate(processname): oSh.SendKeys "{esc}"
		oSh.popup "Step 2 in progress" & chr(10) & "Do not touch mouse or Keyboard" &_
		chr(10) & "Do not close this message",10,"PAD.Designer.exe " & processname,0
		oSh.AppActivate(processname): oSh.SendKeys "{F5}"
		Exit for
	end if
Next
oSh.popup "Fini. Flow will start.",2,"PAD.Designer.exe " & processname,0
WScript.Quit

function ToKnowCommandLine
	Set oSh = CreateObject("WScript.Shell"): Set oFs = CreateObject("Scripting.FileSystemObject")
	For Each objItem In GetObject("winmgmts:/root/cimv2").ExecQuery("SELECT * FROM Win32_Process WHERE name = 'PAD.Designer.exe'")
		Set f = oFs.OpenTextFile(oSh.SpecialFolders("Desktop") & "\LogPadDesigner.txt", 8, true)
		f.writeLine objItem.CommandLine: f.Close
	Next
	WScript.Quit
end function

 

What I am doing to get around the scheduling problem is to incorporate into my flow a WAIT loop which checks for the existence of a file and then runs your flow. I then create a batch file that create the required file for a second and then removes it. This way your flow will know when it is time to run your process and when complete it continues checking for the file. I then have the batch file run on a schedule using windows task scheduler. This approach works a treat. All you need to do is ensure your PAD is started and the flow is runing. Your computer then stays running 24x7 

 

rdeguara_0-1663466026762.png

 

Schedule a Power Automate Desktop Flow From Windows Scheduler

  • Create shortcut on desktop of the flow itself from Power Automate
  • Find the shortcut and click on properties and find the Program and the argument

 

1) Highlight the flow and click the 3 dots

arnatalia_0-1666275869509.png

 

Select “Create desktop shortcut” option and that should place the shortcut on your desktop

arnatalia_1-1666275869517.png

 

Desktop shortcut created as below

arnatalia_2-1666275869523.png

 

2) Right click the Desktop shortcut and select Properties option

arnatalia_3-1666275869526.png

 

arnatalia_4-1666275869529.png

Scroll thru the Target screen and copy and paste the string in clipboard or wordpad or word doc like below. The Windows scheduler will need both this info when you create and schedule the task. The first one is to load Power Automate Desktop and the second one is like the unique address of the desktop flow in Power Automate. If you check flows in Power Automate

        a) “C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe”

        b) ms-powerautomate:/console/flow/run?environmentid=Default-f25493ae-1c98-41d7-8a33-      0be75f5fe603&workflowid=8588dd00-b80d-4526-bd94-55529a43e170

arnatalia_5-1666275869531.png

In Power Automate if you click the 3 dots and click on details, you will see the similar info about the unique address for the flow in Power Automate for each flow. You could copy the unique address or the second string from here also because there is a copy button available and then paste it in Windows Task Scheduler.

arnatalia_6-1666275869537.png

 

arnatalia_7-1666275869548.png

This is all is required to know from the Flow Desktop Shortcut.

======================================================================

Lets create Windows Scheduler Task and assuming you are familiar with how to create task and schedule it.

 

arnatalia_8-1666275869565.png

Click on Create Task and give the meaningful name for the task you are scheduling.

arnatalia_9-1666275869573.png

I am not going to show you all steps required in Windows Scheduler as I assume you know how to schedule the task/job. Below is the main one that you need to know.

 

arnatalia_10-1666275869579.png

Paste those strings you copied from the Desktop shortcut properties.

Action: Start a program and settings as below. Program/Script has to be embedded in double quotes as below. This would be same for any Power Automate flow that you are trying to schedule.

But the Arguments should be inputted without quotes. This will vary based on the flow For eg

  • “C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe”
  • ms-powerautomate:/console/flow/run?environmentid=Default-f25493ae-1c98-41d7-8a33-0be75f5fe603&workflowid=8588dd00-b80d-4526-bd94-55529a43e170

Now Run the task to see if it works. It should work. It takes few seconds to load Power Automate and execute the flow.

 

arnatalia_28-1666276124132.png

 

 

Already replied.

It is possible to schedule Power Automate Desktop flows with Windows Scheduler. I had replied to this post with very detailed information. The steps are very easy to follow even.

@arnatalia, also create a cookbook post here with all these detailed steps which would be of good help to everyone...and then you can point forum answers to your cookbook post. I will point out to your post if anyone is looking for a desktop shortcut or running from scheduler.

https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/bd-p/MPA_Cookbook?filter=desktop%20flows

 

yanhao
Regular Visitor

Trigger a desktop flow from a cloud flow - Power Automate | Microsoft Learn

 You can read this doc.

I also try to use planned tasks,but can't.

Because this feature requires a fee.

Schedule Flows to run your Desktop flows is a Premium License action

I hope you saw my instructions on how to use Windows scheduler to schedule desktop flow. Very detailed instructions on how to schedule it.

We need a premium license to rund this from the shortcut ? what a mess 

What do you mean by:

' then uncomment lines codes below to know information regarding command line, launch this VBS and comment it again.
'ToKnowCommandLine

 

Great But there is NO option to create the desktop shortcut in the free version so this will not work

Hi Johnbor.

Thanks for the message. I also had a free version. I do not have the license version yet and it works for me. So it should work for you also. There are multiple ways to do this. One of them is as below and I already specified it in my very first post. I had also attached the word doc which has complete documentation on how to do it.

 

In Power Automate if you click the 3 dots and click on details, you will see the similar info about the unique address for the flow in Power Automate for each flow. You could copy the unique address or the second string from here also because there is a copy button available and then paste it in Windows Task Scheduler.

arnatalia_0-1672245689797.png

 

arnatalia_1-1672245689827.png

This is all is required to know from the Flow Desktop Shortcut.

Thank you for your effort but for us there is really no option like this in the free version. Screenshot 2022-12-29 073837.png

Anonymous
Not applicable

because it need license, we need something free

@evilnw Thanks very much for this.  I want to use this to stop a flow at a certain time. 

However, if, say, I want to stop on 00:00, if I use Currentdatetime.Minute = 00 it doesn't seem to allow it and use both digits and instead it uses Currentdatetime.Minute = 0 instead.  WIll it still work?

Thanks so much.

Hi Arnatalia, when I run the scheduler task, it pop-up below screen every time, how to avoid it and run flow directly?

lion_0-1693468064197.png

 

By default, Power Automate always prompts you to confirm the triggering of a desktop flow via URL or desktop shortcut. To disable this functionality, navigate to the console settings and disable Display confirmation dialog when invoking flows externally or modify the appropriate Windows registry entry

thanks for the advise, after disable the option, upon dialog not pop-up again, but it pop-up another screen like below, how to by pass it?

lion_0-1693530559916.png

 

Thanks, it's seem great but like Fuji98 and others it's not working for me, I dont have acces to URL workflow or environnement ID needed or such v2 interface you have. Do you really have only a personnal and free account off line account ? Whatever if someone have a solution I'm interrested but I have no big hope regards to research I made : 

https://powerusers.microsoft.com/t5/General-Power-Automate/Get-Current-Environment/td-p/1375540 

https://www.youtube.com/watch?v=pFZSajbQsxc  

https://learn.microsoft.com/en-us/power-automate/desktop-flows/run-desktop-flows-url-shortcuts#prere...  

 

For those interested, the easiest solution I've found is to associate my flow to a shortcut and simulate this shortcut with an ahk script when Windows starts up

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (815)