PowerShell to force-kill a process

Tag: SCRIPT
Edit

The script is based on one I found at https://social.technet.microsoft.com/Forums/lync/en-US/43fa0ba5-f5b6-43b7-a10b-4957bc4a5f19/how-to-search-a-pid-with-service-name-and-then-task-kill-it.


# Find the process in question
$ServicePID = (Get-WmiObject win32_service | ? { $_.name -imatch 'Logger' }).ProcessId

# Kill the process with fire.
Stop-Process $ServicePID -Force