Encounter errors while trying to kill a process

Hi everyone,

i have recently encountered a problem quite often (though not all the time) - “encountered errors while trying to kill a process”

Background info:

we have several robots running on our server. sometimes the robots encounter error while trying to kill SAP process but not always. The whole process stops because it runs into error in the “Init” state. I could not think of any possible explanations. Anyone else has an idea why?


In the Kill process activity enable the “Continue on Error” option, that will resolve this issue. Or check for the processes in the current session and then kill those alone. Don’t kill all the processes from all session.

Okay, while trying to kill a Java app also I encountered similar difficulties.

Try ‘Close application’ with generous delay and timeOutMS and then wrap it with a try catch, and in Catch kill that exact process (get processes and if that process exist use kill process) with ContinueOnError property as true :slight_smile:

If you are still not able to end/close that app then use a powershell/CMD prompt to end/stop the service and try again the above process. This should work because it has never failed me though.

1 Like

HI @Raghavendraprasad - do you have any xaml code for these steps you described? I have encountered the same issue.

@miketong44 - is this issue resolved?

@sarathi125 - how to check the processes in the current session?

UiPath ReFramework 101: Killing a User-Specified Process | Aggranda

Check this out. This may solve your issue. Maybe you Kill process is trying to kill a process which would be open by another user and you current user does not have the rights to kill that particular process.

Althought, the “ContinueOnError” check on the Kill Process activity would also solve your issue as well.


Check if the process you want to kill is running or not? if running, then kill the process.

How to check if process is running or not?
Process.GetProcessesByName(prc).Count > 0

If true, Kill the process else do nothing.