How to make UiPath wait until the powershell command is finished executing

I have a powershell command which varys everyday in it’s execution time, Sometimes the Command takes 5 minutes to execute, sometimes 7, sometimes 10. So How Do I identify if the execution of the command is finished ?

Cross reference:

@Ishan_Shelke

at the end of your powershell script can you add a command to create a text file e.g. c:\test\finished.txt.

in uipath after you call your powershell script,
just wait until c:\test\finished.txt exists

Ideally your script should have try-catch-finally statement, and file should be created in the finally block (this is so that uipath doesnt wait forever in the event of an exception).
You can also write the result of the script into this file e.g. “Success” or the exception message if theres an exception. Then let uipath read this file in order to know if theres an exception/success

Tried File System Monitoring

I had one question Though When I execute the Command the file generated is at 0KB till the execution is finished, once the execution is finished the file size changes to let’s say for example 500KB

Is there A way where I can continuously monitor the file until it’s file size changes from 0 to something ?

just check at your end it the call is synchronous or asynchronus.

when it is sychronous the suggestion of @jack.chan is a good option to handle it

Thanks For the Approach @ppr , @jack.chan. What I did Just Added a semicolon at the end of my command and created a new test file and used path exists activity to proceed forward.

Thanks for your Valuable Time

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.