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 / Logs not being uploaded
Power Automate
Answered

Logs not being uploaded

(0) ShareShare
ReportReport
Posted on by 5

I have a looping script which runs automatically at start on a server.


To ensure that this script is always running, the first action of the loop is to call a PowerShell script which starts with a 30 min sleep, then if that expires, a shutdown -r command is run next. If the PA loop completes before 30 minutes, the PowerShell window is closed at the end of the loop, before being started again at the start of the next loop (starting another 30 minute timer).

 

Recently the loop is sporadically failing due to unknown reasons, as the server is unattended. The script is more than likely waiting for on-screen text via OCR when the time out/restart occurs (so the script hasn't technically "stopped" in PA terms). Whenever the restart command is run however, PA is not logging the script as a completed/failed/interrupted run, and no logs are being uploaded to make.powerautomate.com to assist me troubleshooting.

How can I ensure these logs are uploaded? Do I need to introduce an extra PowerShell command to "gracefully" terminate the hung PA script before the shutdown -r command?

I have the same question (0)
  • Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    Can you elaborate a bit on why you even need the shutdown command there anyway?

     

    Also, what is your flow supposed to do within the 30 minutes?

     

    As for the flow run action details being uploaded to cloud - do you have a Premium license? That is required for having desktop flows in combination with the cloud. If you do, again, why do you need the PowerShell script? 

     

    Also, it might be that the reason why those details are not uploaded, is because your flow doesn't actually complete. You would likely need to terminate it somehow. But I'm quite sure there are better ways to do what you're trying to do than having that script. If you only explained it a bit more, we might be able to come back with suggestions.

  • jt3204 Profile Picture
    5 on at

    Thanks for the reply. Happy to provide more info and work on a good solution.

     

    Yes, the account has a premium licence as I needed it to be able to have the PA script run when the server boots/reboots (whether expected or unexpected) due to it being unattended and critical that gaps in the script not running are avoided. I use a scheduled task (on boot) to run the desktop shortcut created by the "create shortcut" function in PA.

     

    The script runs an ~18 minute series of key entry functions/data manipulation to interact with a legacy program to generate an output from that program. The entries need to be repeated ad infinitum, hence the loop. Unfortunately the only way I've found for the script to wait for the right moments to enter some of the data/continue the next action is to use the OCR wait for text on screen method, which if an unexpected window or error pops up, or the legacy program crashes, causes the script to hang. 

     

    As a brute force method to recover from the script hanging regardless of the cause, I set up the 30 minute PowerShell timer to just restart the server as the recovery method. It works very well, but leaves me with no debugging information to actually see why the script didn't keep running.

     

    Also, it might be that the reason why those details are not uploaded, is because your flow doesn't actually complete. You would likely need to terminate it somehow. But I'm quite sure there are better ways to do what you're trying to do than having that script. If you only explained it a bit more, we might be able to come back with suggestions.

    Perhaps to ensure it "completes" before the shutdown -r command, I could run the "stop" version of this?

     

    "C:\Program Files (x86)\Power Automate Desktop\PAD.Console.Host.exe" "ms-powerautomate:/console/flow/run?workflowName=[Name]"

     

     

  • Verified answer
    Agnius Bartninkas Profile Picture
    Most Valuable Professional on at

    If you have any "Wait for {something}" action, there is always a timeout option in the action. Make it fail on timeout and then your flow will complete. If you want it to restart, build some error handling into it and recover.

     

    Here's where to find it in the Wait for text on screen (OCR) action:

    Agnius_0-1708667940759.png

    At the very worst (if you do not implement any error handling), your flow will terminate on error, instead of hanging up, and so the logs will be uploaded before your script reboots the machine.

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 252 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 169

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard