Categories
PowerShell Scripting

Powershell Stop-Process, WMI & Filtering

Search for specific processes using WMI and then stop these processes.

$vResult1 = Get-WMIObject Win32_Process -filter "CommandLine like '%<argument>%'"
foreach ( $vProcess in $vResult1 ) {
  Stop-Process -Id $vProcess.ProcessId
}