Showing results for 
Search instead for 
Did you mean: 
New Member

Wait for a time when computer hibernate hangs the workflow



I don't usually post because my problems found solutions other posted. So I faced this problem and I couldn't find a ready made solution. After a day of work found a solution and decided to contribute. 


I have a power automate desktop workflow that need to run continuously to regular intervals with a wait time between processes. Using trigger with an external workflow is not an option. The workflow works on a personal notebook, so i must be able to sleep/hibernate my notebook and the workflow should continue to run gracefully.


Solutions tried and failed:

- using native pad 'Wait an interval'. When the computer hibernate the workflow hangs and stop working and the only way to regain control of the workflow is kill every process of PAD.

- using a wait inside powershell script launched from PAD. It has the same problem than the first method. 

- using a powershell script to set an endtime and compare if current Time is greater than endtime. The problem is the same. I don't know if it has to be that i needed to add a wait-event with timeout 0, to avoid trigger processor consumption in the loop, but at the end, when the computer hibernates the workflows hangs.

All of the above solutions worked fine as long as i don't hibernate my notebook, but failed when i do.



Execute a powershell script from the pad to:

- Suscribe to power management events

- wait for events with timeout equal to desired interval between executions.





Register-WmiEvent -Class win32_PowerManagementEvent -SourceIdentifier power
Wait-event -Timeout %ValorIntervalo%





In this way the script ends following two conditions: 

- When timeout occurrs

- When a power event happens.

These seems to work fine and avoid the workflow hanged problem. Side effect: It will execute the workflow everytime I dehibernate my computer. That is not a problem for me.


May be my problem is too particular (and hence I didn't find a ready made solution). I hope it is useful to someone, anyway.


Best regards,




thank you so much @EdgardoMenta  for enabling the community with your experience. 


Happy Automation,


Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (1,745)