Kill Process activitie tries to kill a process fom another Windows User

Hello together.

I tried to kill a specific process with the ‘Kill Process’ activitie in a Windows Server 2016 environment.
Two users are logged on to the machine at the same time to work on different RPA processes. We both automate the same application. As soon as in tries to close the application via the ‘Kill Process’ activity, an exception is thrown: Can’t stop [APP NAME]: Encountered errors while trying to kill a process.

Now I noticed that this error only occurs if my colleague has opened the corresponding application as well. Apparently the activity tries to close the process of the other Windows user.

I looked at the documentation of the activity and couldn’t find a way to disable this behavior.
Do you have a hint for me how to solve the problem?

May i know why we do it in same time
can we do in sequence @Robin_S

Because the implementation of the RPA processes is a high priority and we and this company have one machine to develop. Accordingly, we have to parallelize the development of both processes.

You must contact UiPath company…
We have additional packages for us - Killing Process for self.
We can use on the server and we don’t kill each other processes.
For example I can kill my own process for Excel, not for everyone on the server.

Thanks for this tip. But I found a own way to fix this problem.
For the development of a solution I implemented a small prototype in VB.Net. It looks like this:

Sub Main()
    Dim processUser As String
    Dim processName = "chrome"
    Dim currentUser As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name
    Dim processList = Diagnostics.Process.GetProcesses().ToList().Where(Function(process) process.ProcessName.ToString().Equals(processName.ToLower()))
        For Each process In processList
            processUser = GetProcessOwner(process.Id.ToString())
            If process.ProcessName.ToString().Equals(processName.ToLower()) And currentUser.Equals(processUser) Then
            End If
    Catch ex As System.InvalidOperationException
        'The process was closes by another user or application.
    End Try
End Sub

Public Function GetProcessOwner(processId As String) As String
    Dim query As String = "Select * From Win32_Process Where ProcessID =" & processId
    Dim searcher = New ManagementObjectSearcher(query)
    Dim processList As ManagementObjectCollection = searcher.Get()

    For Each obj As ManagementObject In processList
        Dim argList = New String() {String.Empty, String.Empty}
        Dim returnValue As Int32 = Convert.ToInt32(obj.InvokeMethod("GetOwner", argList))

        If returnValue.Equals(0) Then
            Return argList(1) & "\" & argList(0)
        End If
    Return "NO OWNER"
End Function

In this solution, I first search for a specific process and iterate through all the processes found under that name. Then I get the ProcessOwner for the process and compare it with a specified user or the current user. If the users are identical, I can assume that the process was started with the searched user and can close the process.

Here is a possible solution as UiPath implementation:
Get process owner.xaml (5.1 KB) Kill Process.xaml (8.8 KB)

I’d like to note that this solution could be significantly improved by distinguishing between Windows offline users and online users (Windows AD users).


In the “Kill Process” modul is an optional input field called ‘in_UserName’. If you want to kill the process for a specific user you can input a user name like this “DOMAIN\USERNAME” otherwise the current user will be selected.

Little fix + adding NetworkUser option.
Get process owner.xaml (7.7 KB) Kill Process.xaml (11.2 KB)


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