Kill process by filename

I would like to slightly improve Shay Levy's answer, as it didn't work work well on my setup (version 4 of powershell)

Get-Process | Where-Object {$_.Path -like "*something*"} | Stop-Process -Force -processname {$_.ProcessName}

You can get the application path:

Get-Process | Where-Object {$_.Path -like "*something*"} | Stop-Process -WhatIf

That will work for the local machine only. To terminate remote processes:

Get-WmiObject Win32_Process -Filter "ExecutablePath LIKE '%something%'" -ComputerName server1 | Invoke-WmiMethod -Name Terminate

Tags:

Powershell