Kill process by name and owner?

Chris J

Before I look into reinventing the wheel and roll my own, is anyone aware of an application/utility that allows me to kill processes, filtering by both process name and process owner? Alternatively could this be done through powershell? (My powershell-fu is sadly lacking).

I've looked at both pskill and taskkill. Although pskill allows terminating by process name, it doesn't allow me to further filter by process owner. I've also looked at WMI via wmic (wmic process), but the WMI interface doesn't return the process owner (at least from what I can tell), so can't use this either.

Rationale
I do a chunk of development on Windows. Some of this involves dealing with Component Services (COM+). COM+ has a generic host process - dllhost.exe - that's used both for custom (i.e., stuff I've developed) elements and system processes. I can differentiate them by the owner they run as. So, for example, I want to kill all the dllhost.exe processes owned by me, but ignore the ones owned by SYSTEM.

This would save me going in to Task Manager on a regular basis and identifying and manually killing each one :-)

EBGreen

In powershell you would do:

gwmi -query "select * from win32_process where name='PROCESSNAME.exe'" | %{if($_.GetOwner().User -eq 'USERNAME'){$_.terminate()}}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Kill process by name in ubuntu

From Dev

How to scan and kill a process by name

From Dev

Kill shell script process by name

From Dev

command to kill all process by name

From Dev

How to name a process for command and kill it later by name?

From Dev

Linux kill process by cmdline (multiple with same name)

From Dev

Kill a java process using its Name and not PID

From Dev

How to kill all process with given name?

From Dev

How to kill all process with given name?

From Dev

How to kill a process with name having spaces?

From Dev

How to kill a specific java process by application name

From Dev

Kill a java process (in linux) by process name instead of PID

From Dev

How to kill a process using the window's name of this process with python or bat

From Dev

how to kill a process windows in python with asking the process name in programme(script)

From Dev

Kill process in batch file that matches certain name and user

From Dev

how to kill a program by process name using cmd in windows 8?

From Dev

How to kill the process using the name of the program instead of PID?

From Dev

How do you kill a process by name for all users?

From Dev

How to kill the process using the name of the program instead of PID?

From Dev

Linux: How to kill a root owned process by parameter's name?

From Dev

How can I kill process by specific name and exclude root processes

From Dev

How to kill process with the same name but ran in different directory?

From Dev

kill a process by name if running longer than 24 hours

From Dev

How to kill a process using its name in perl script on windows

From Dev

Determine the owner of the session of a process

From Dev

Kill a process by PID started by Batch Script (avoiding other process of same name)

From Dev

kill all process greater than some process ID and match with particular name

From Dev

Automatic Process kill process problem

From Dev

How to kill a stale process

Related Related

  1. 1

    Kill process by name in ubuntu

  2. 2

    How to scan and kill a process by name

  3. 3

    Kill shell script process by name

  4. 4

    command to kill all process by name

  5. 5

    How to name a process for command and kill it later by name?

  6. 6

    Linux kill process by cmdline (multiple with same name)

  7. 7

    Kill a java process using its Name and not PID

  8. 8

    How to kill all process with given name?

  9. 9

    How to kill all process with given name?

  10. 10

    How to kill a process with name having spaces?

  11. 11

    How to kill a specific java process by application name

  12. 12

    Kill a java process (in linux) by process name instead of PID

  13. 13

    How to kill a process using the window's name of this process with python or bat

  14. 14

    how to kill a process windows in python with asking the process name in programme(script)

  15. 15

    Kill process in batch file that matches certain name and user

  16. 16

    how to kill a program by process name using cmd in windows 8?

  17. 17

    How to kill the process using the name of the program instead of PID?

  18. 18

    How do you kill a process by name for all users?

  19. 19

    How to kill the process using the name of the program instead of PID?

  20. 20

    Linux: How to kill a root owned process by parameter's name?

  21. 21

    How can I kill process by specific name and exclude root processes

  22. 22

    How to kill process with the same name but ran in different directory?

  23. 23

    kill a process by name if running longer than 24 hours

  24. 24

    How to kill a process using its name in perl script on windows

  25. 25

    Determine the owner of the session of a process

  26. 26

    Kill a process by PID started by Batch Script (avoiding other process of same name)

  27. 27

    kill all process greater than some process ID and match with particular name

  28. 28

    Automatic Process kill process problem

  29. 29

    How to kill a stale process

HotTag

Archive