PowerShell To Kill Task / Process
One common task you might find yourself doing is killing processes. PowerShell can help you automate doing this. There could be several different reasons you might want to do this. An application might be stuck or frozen. One way to fix this would be to forcefully kill it before starting it back up again. Another reason to do this might be to kill processes that don’t need to be running. You might want to kill off extra processes that are eating up your system resources.
You can kill a process by name like this:
Stop-process -Name Chrome Stop-process -Name Notepad
You can kill a process by PID like this:
Stop-process -Id 14168
If you want to find the PID of a process you can search for it like this:
tasklist | findstr notepad