TL;DR: The PowerShell equivalent of taskkill is Stop-Process. It terminates running processes by name or ID, supports force-stopping unresponsive apps, and works natively with Get-Process for safer scripting.
If you’re coming from Command Prompt and moving your workflows into PowerShell, process management is one of the first things you’ll want to translate. Taskkill has been around forever, but PowerShell gives you a more scriptable, object-based way to stop running applications, especially when you’re automating deployments or cleanup steps.
What does taskkill do?
Taskkill terminates running Windows processes by name or process ID, commonly used to close frozen or unresponsive applications. In instances when an app freezes, you may need to add the force switch (/F) to make the app behave. Using the force switch is similar to launching Task Manager and ending the task from there.
Of course, there are several other reasons why you might use the taskkill command, especially if you are deploying updates. In fact, if you look at several of the prebuilt packages in PDQ’s Package Library, they contain a command step that uses the taskkill utility to end an application's process. (That just helps us avoid an error message later about a process running in the background.)
Here's an example of the FileZilla package from the Package Library.

The taskkill command is pretty straightforward to run. As always, if you want to find out more about a command, add the /? switch after the command, which will return the help documents about the command.
The most common use is to run the command followed by either the process name, also known as image name (/IM), or the process ID (/PID).
taskkill /IM notepad.exeAnother useful command to use when using taskkill is the tasklist command. If you don't know the name or the process ID of the task you want to terminate, tasklist is what you need. Tasklist returns a list of all running processes, listing both the process name and process ID.

Of course, we're not here to discuss old Command Prompt utilities, so let's find out more about the kill process in PowerShell.
What is the PowerShell equivalent of taskkill?
Stop-Process is a built-in PowerShell cmdlet used to terminate running processes by name, ID, or pipeline input.
NAME
Stop-Process
SYNTAX
Stop-Process [-Id] <int[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Stop-Process -Name <string[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Stop-Process [-InputObject] <Process[]> [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
ALIASES
spps
kill
REMARKS
Get-Help cannot find the Help files for this cmdlet on this computer. It is displaying only partial help.
-- To download and install Help files for the module that includes this cmdlet, use Update-Help.
-- To view the Help topic for this cmdlet online, type: "Get-Help Stop-Process -Online" or
go to https://go.microsoft.com/fwlink/?LinkID=113412.
Okay, I'll be the first to admit it: The name is a little lackluster. Especially when compared to TASKKILL!!!. Stop-Process just doesn't carry the same hostile undertones.
You'll notice that we have some familiar switches available with the Stop-Process command, such as -ID and -Name. We also have the -Force switch for those times we need to strong-arm a process into submission. Let's see what we can do with a few examples.
Ready to write your own PowerShell scripts?
Check out our four-step guide on how to write and run a PowerShell script.
How to use Stop-Process with the –Name parameter
Stop-Process -Name 'notepad'This is the most basic example of this command, but there is something interesting to note. When using the -Name parameter, Stop-Process closes all running instances of the specified process.

If you use the -ID parameter instead of -Name, you can specify which instance you want to terminate. Also, note my use of the Get-Process command instead of tasklist in the image above. These commands serve similar functions, but Get-Process is for PowerShell and tasklist is for Command Prompt.
Easily run PowerShell scripts on remote devices
Need to run your awesome PowerShell scripts on remote devices? PDQ Connect can easily execute PowerShell scripts on any managed device with an active internet connection.
How to stop multiple processes at once
This approach uses an array of process names and passes them to Stop-Process in a single operation.
$List = 'notepad', 'win32calc', 'chrome'First, we've taken the process names and assigned them to the variable $List. Next, we could use a ForEach loop to iterate through each $Item in the $List variable. We can also go hardcore and use the kill alias instead of Stop-Process ... because why not? And finally, we can use the -Force parameter just in case any of these processes try to go rogue and not close like they're supposed to.
How to check if a process is running before stopping it
In this example, we'll check to see if a process is running before terminating it.
$app = 'Chrome'
$process = Get-Process $app -ErrorAction SilentlyContinue
if ($process) {
Stop-Process $process -Force
Write-Output "$app has been stopped."}
else {
Write-Output "$app is not running."}
First, let’s assign the process name to a variable ($app) so we can check for other processes easily in the future. Next, we use the Get-Process command to check if the process is running and assign it to the $process variable. We use the -ErrorAction parameter to SilentlyContinue if the process isn't running. Next, we use an if/else statement to stop the process if it is running, and if it's not running, return the output $app "not running."
If statements in PowerShell
Need a refresher on if logic? Check out our blog on how to use if statements in PowerShell.
Reason 101 why we love PowerShell
Stopping processes is one of those things we do dozens of times a day, and we probably don't even realize it. I can't tell you how many times I close Chrome or a PowerShell window just to open it back up again two minutes later. It works flawlessly 99% of the time. But, the one percent when it doesn't can sure be frustrating. Well, at least now you have one more way to handle those stubborn processes.
Are you a fan of PowerShell? So are we (just in case you couldn't tell). Stay tuned to our website for more PowerShell blogs, and don’t forget to join us every Monday for a new episode of The PowerShell Podcast!




