If you are an “old” school IT guy as I am, then you would know tasklist and taskkill, which can be executed from the command prompt. You would often use these to get a list of tasks for afterwards to kill a running process with taskkill.
So how is this be done in PowerShell?
If you execute tasklist in a command prompt you would get a list like this:
You can get a similar list in PowerShell with the command Get-Process:
To kill a process in the command prompt you use taskkill with parameters, in this example I use PID (Process ID) to kill the notepad process. You could also use flags like IM (Image Name) or FI (Filters). You can read more about the taskkill parameters here.
You can do the same in PowerShell. The command here is called Stop-Process and you can read more about it here.
In my example I used ID, which is equivalent to PID in taskkill.
So in short terms:
tasklist is equal to Get-Process in PowerShell
taskkill is equal to Stop-Process in PowerShell
Be the first to comment