Looping error open app

hello, I want to ask. I have a flow that repeats endlessly using PowerShell. Before the robot opens Powershell, I have given it a kill process activity to close Powershell. What I wonder is why when the robot is running, sometimes the robot can repeat a lot without problems, but sometimes the robot experiences an error when it wants to open PowerShell. Maybe there are suggestions that I should add so that my process doesn’t experience errors. Thank you for the help

@wsinten,

Instead of using Kill Process activity to close PowerShell, add logic to close it swiftly.

Issue with killing an application or service:
It doesn’t give the process a chance to cleanly:

  1. Shut down socket connections
  2. Clean up temp files if any.

Solution to you issue, add logic to close the PowerShell instead of killing it.
If killing is the only option, add some delay before starting next loop this will give system to close previous instance properly and you will not face any issue.

Thanks,
Ashok :slight_smile:

hi @ashokkarale,

thank for your answer. but I’ve also used the logic to close PowerShell. I added a process kill activity just to validate that when the robot opens Powershell, it has to make sure that the Powershell window doesn’t have an open window. What makes me wonder is why the flow I create can sometimes last up to 24 hours, but sometimes it only lasts 15 minutes. is there any other solution?

@wsinten,

As per my understanding initializing new PowerShell window and killing it after script execution could be the issue.

Instead of closing or killing can’t you reuse the same window for next script execution by clearing everything of last script command and output texts.

You will have to just add the logic to clear existing data on screen.

Thanks,
Ashok :slight_smile: