cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sumeth_002
Regular Visitor

UI flows unattended issue

Annotation 2020-07-06 112743.png

hi guys , 
 i  am having the problem as you guys above picture , i cant access the unattended flow and error message show ( " There is a user session on the target machine. Cannot execute unattended UI Flow")  . but i tested that flow in attend mode its run successfully for me . 
thank you . 

32 REPLIES 32

@Anonymous have unattended flows ever worked for you?

Have attended flows ever worked for you?

Do you have a current license for unattended RPA?

Physical or virtual machine? If virtual, what hypervisor?

To be clear, you are getting the following error, right?

"There is a user session on the target machine. Cannot execute unattended UI Flow"


Your target machine is not configured to login automatically, right? Can you login to the target machine and manually run the flow –not even attended (cloud) or unattended (cloud)– but direct from PAD? Just open Power Automate Desktop and try to run the flow in question directly from the PAD console. What happens? Now sign out of all user accounts and try running unattended flow. But first, are you sure the correct machine/gateway is selected for the flow to run in? Have you configured it with correct credentials?

Do you have the Power Automate Desktop gateway application installed or do you have it configured as a PAD "machine" connection?

Can you provide the exact output from the action that triggers the error? (scrubbed for private info of course)

No one can help you beyond providing links to the documentation unless you provide some more details about your situation and the context of the error you're seeing.

Anonymous
Not applicable

Hi HEATFreight, thanks for the reply.

 

Both attended and unattended have worked and do sometimes work on this VM. It seems to be simply unreliable. I have placed my PAD flow in a loop so it will retry it like 10 times or until it runs successfully and oftentimes it makes it before the 10 are up.

Knowing that it works sometimes, I suppose most of your questions get answered but let me try anyway.

I believe it is a physical machine, I log into it via Remote Desktop Connection.

This is the exact error. I don't think it'll let me see more details:

Jsalaz1989_1-1643128764308.png

I have been able to run the flow on that machine both from PAD directly as well as from Power Automate in attended mode (and again, unreliably as unattended as well).


To make sure nobody is signed in, I restart the machine and shortly after try to run the flow. Due to the aforementioned loop, it will then error out a couple of times until it finally is able to run successfully:

Jsalaz1989_2-1643129164423.png


It honestly just feels like unreliability of the Microsoft product but who knows.

 

Do you have physical access to the machine into which you are attempting to RDP? Does anyone else use that same machine besides yourself?

When you say 

I believe it is a physical machine, I log into it via Remote Desktop Connection.

that's the part you should stop doing!

Do not log into the machine via the remote desktop connection. Or if you need to login to verify the machine is running, then make sure to sign out of all user accounts on that machine before running the attended flow. Your remote desktop connection is blocking the "unattended" flow. The machine needs to be powered on but with no users signed in. No local users, no remote users, no users at all!


Anonymous
Not applicable

Of course not, I do not log in and then try to run the flow unattended, that would be dumb...

 

I'm saying that if and when I do want to check out the machine, I RDP into it. Then, to make sure nobody is logged in, I hit restart and a few minutes later (without logging back in obviously) I try to re-run my flow. I don't have physical access to it, but I'm pretty sure nobody else logs into it. 
I can say the unreliability is quite consistent, if that makes sense. Basically every time it will try to run it about 5-8 times, giving that error, until suddenly it manages to run it.

Once it runs successfully, do further runs also fail several times before succeeding? Or does it ever "hit its stride" so to speak, and run successfully several times in a row?

Is the Windows operating system on that machine fully patched and updated to the most current version? What about the PAD gateway / PAD app, are they both fully updated? Or do you use a PAD "Machine connection" rather than PAD gateway to connect to the machine on which to run unattended flows? I must admit some ignorance with regard to running unattended flows, but I feel like there could be some error I might be able to spot if I had all the details, because I run a ton of attended flows and I'm fairly proficient at working with those. Unattended can't be that much different, I wouldn't think.

But yeah it does sound like you know what you are doing and that you've done the right things to make this work. My guess is that the error is wrong. Maybe there is no other account signed in, but something else is causing that error to be generated. Maybe some Windows system credential in triggering as if it's a signed-in user. 

Can you open a Command Prompt and run

net user

and provide the output?

Or press ⊞Win+X and click Computer Management, then >Local Users and Groups >Users. What all sign-in accounts do you see?

I suggest following these instructions to verify that you are the only user signing in on that machine.

If no clear reason for issue, you should spool up a Hyper-V virtual machine on a machine that you do have physical access to, and attempt to run the unattended flows in that VM instead.

If issue persists, who knows... But if issue goes away, then you are probably not the only user on that machine you're currently trying to use.

Anonymous
Not applicable

IT maintains that machine. I have to assume it is patched and updated. I'm using a very recent PAD, perhaps the most recent, I can't imagine that it would fail just because it is one or two minor versions behind.

The two outputs:

Jsalaz1989_0-1643139832705.png

Jsalaz1989_1-1643139928894.png

Might have to get together with IT to check out the Event Viewer:

Jsalaz1989_3-1643140586319.png

And also to enable Hyper V.


I'm almost certain nobody else is using that machine, because (1) we're a tiny RPA team, (2) I run it in the morning in Europe and anybody who would try to use it would be in the US and I doubt they're logging in at 2 AM, (3) doesn't make sense that every time it consistently attempts to run a few times before finally succeeding, (4) there are many other posts out there claiming a similar issue, and (5) without wanting to muddy up the issue I am in parallel struggling with a similarly unreliable issue regarding a 'Could not attach to Edge' problem. Microsoft's official workaround for that problem is "make the action retry 20 times with 5 seconds in between". That workaround works half the time, the other half it attempts the 20 times and doesn't manage to attach and the entire flow fails. It just feels like an all-around unreliable product so I'm tempted to blame Microsoft rather than our infrastructure or code, but proving that feels harder than just putting up with the unreliability. 

Gauravmahajan
Frequent Visitor

@Anonymous Thank you for providing the level of detail that you have. Everything you've mentioned or are doing seems to be right. Also, we have been running unattended flows for a while now on multiple machines and have never faced this error unless of course there's an actual user session of some sorts on the machine.

 

So just an out of the ordinary thought here: Could it be that the loop is causing hanging sessions? A couple of things I can suggest:

1. Increase your allocation of unattended licenses to the environment and then test

2. Make sure multiple flows are not trying to run on that machine at the same time 

 

I would also recommend trying a clean test (you mentioned you have already tried this but I would also include steps 3 and 4 in your tests):

1. I would recommend first removing the for-loops removed from your calling cloud flow

2. Restart the machine

3. Login to it and make sure that all the windows services have started correctly  (power automate services and the on-prem data gateway service) 

4. log out of the machine 

5. now run your unattended flow

 

That's the only thing at least I can think of.

 

Failing all this, you (ideally) or your IT should be able to create a support ticket through the Power Platform admin center

 

Thank you and hope this helps 

Yeah it definitely looks possible that you have other accounts which could be trying to sign on to that system simultaneous to your attempted flow runs, but hard to verify without more info from IT.

I agree with @Gauravmahajan that simplifying the flow to avoid the loop and possible simultaneous flow runs might help you troubleshoot the issue. We use attended flows, so not exact same situation as you, but we had to implement a "flow running" flag to check flow activity before starting any new flows. We have a .txt file saved on the machine which is set to 0 if no flow is running, and before running any PAD flows we use a File System connector in Power Automate cloud flow to change that value to 1. Then after that flag has been set to 1, the cloud flow triggers the desktop flow, which also immediately writes 1 to flag .txt file, just in case by unlucky timing another flow has somehow set the flag back to 0 after the new flow's cloud trigger had already written 1. When the desktop flow finishes running, the last thing it does before exiting is reset the .txt file to 0 so that any other flows in queue can then run as well. Before each PAD flow runs, there is a loop running in the cloud flow to check for flag value of 0. Once value of 0 is returned, the loop exits. The cloud flow then sets the flag to 1 and launches the next PAD flow, which also writes 1... and so on.

This prevents the timeout error timer from starting until the flow is actually launching for real. As far as we can tell, Power Automate starts counting the PAD flow run time from the moment that Power Automate cloud flow triggers it, rather than from the moment the PAD flow actually begins running. Without the "flow running" flag, multiple flows can be queued up on the same machine such that the error timeout for a queued flow starts counting before the previous flow has finished running, thus causing cascades of unnecessary timeout errors.

The flag value logic completely resolves the issue of multiple queued PAD flows causing subsequent PAD flows to time out, well except in unlucky cases where multiple PAD flows are triggered nearly simultaneously. In that case, they may both see the same flag value of 0 before the other has had a chance to update the flag to 1. Thus whichever PAD flow happens to queue up later will still be at risk of timing out (we use short timeout durations so that no flow can get hung up and cause other flows to fail to run on time).

Anyway, I say all this because the idea that one flow run could interfere with another and present you with this error is intriguing! Does a flow run count as an active user session? But isn't PAD supposed to just deal with the incoming queue of flows and run them sequentially? Lot of stuff I don't understand here...

HEATFreight_0-1643150257324.png


I think you should make the simplest possible PAD flow and launch it from the simplest possible cloud flow, and only test adding additional complexity only once you have the simple stuff working reliably.

Some additional thoughts:

Do you have any scripts or group policies that run periodically on that machine in the background?

Is it possible that there is some script or group policy which is executing some code that –while running– makes it appear to the Power Automate system as if a user is signed in?

Not a Windows expert, so unsure of whether the premise of this question is even reasonable or if I'm being totally nonsensical, but it seems to me that your machine is doing things you don't understand and don't have much visibility into and which could interfere with your flow runs. It seems to me that you don't have complete assurance that there are no other RDP sessions and that there are no other scripts or programs running on that machine which might produce an "active session" error. Seems to me that starting fresh in an environment with no possibility of unknown external interference from other users or background programs is your best bet, but guessing that's not an option for you. If you don't have such a system, Power Automate unattended RPA probably ain't for you. Not sure of better alternatives. All I know is you either need the system all to yourself, or you need someone to orchestrate the management of exactly who might be RDPing into that system at any given time and to manage the execution of cloud flows that trigger PAD flows to coordinate resource usage among all users. Your IT folks probably need to spin up more resources if this one seems to be having conflicts between users.

Anonymous
Not applicable

Hi @HEATFreight and @Gauravmahajan, these are all good tips and it's definitely possible that one of them could reveal something about the machine I am not aware of. However, it seems like a lot of work to tease out the root cause so for the next few days I am going to shift gears a bit. I will try to just get Selenium (Python) running directly on that VM and see if it's a smoother experience. I understand you miss out on a lot of advantages of PAD when you roll your own stuff but you also avoid a lot of headaches. If I'm unsuccessful with this new strategy I'm sure I'll be back to test out your tips. Thanks for the help!

You ever figure it out?

I ended up building a sprawling canvas app to get rid of all the PAD flows I built to run browser automations on this janky legacy software we were stuck with, which tended to be slow and unreliable at times. Overall, a time-saver but still a massive boondoggle when things would fail for no apparent reason, where the usual culprit was probably the crappy website for said legacy software. Very difficult to track and correct errors from browser automations.

We went all-in on building a canvas app to fully replace the janky legacy software, and it's pretty sweet! Orders of magnitude improvement in runtime to complete the same tasks as well as in terms of development efficiency.

Anonymous
Not applicable

No, I ended up going that different route mentioned in my post so I never found out what the issue was with PAD.

this is still not functioning software.  I have paid for all the licenses needed to run automations in unattended mode and it still doesn't work.  i have followed all the BS resolution docs, read all the forums and still no solution to my problems.  i invested even more time than money into this software and it is an utter and complete waste of time.

If the error keeps coming up, it means that you have at least one user logged in.

The best way I have found to run unattended flows it's to restart the machine, even if it is a VM (I only use VM to run my flows).
Signin out of your use account, won't work. I have tested it and each time I sign out, the Power Automate Cloud tells me that there is a user session on the target machine.

 

My advise it's to restart the machine after every time you access it with your account (you don't need to restart it after the Power Automate Cloud ran a flow).

 

Hope this helps!

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (4,977)