How to stop the specific instance of the process in PowerShell?


To stop the specific instance of the process, Process ID needs to provide to Stop-Process cmdlet.

Example

In the below example, we need to stop Notepad process with instance ID 25400.

Output

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    228      14     3156      13680       0.13   4900   1 notepad
    232      14     3196      13752       0.16  25400   1 notepad
Stop-Process -Id 25400

Now, when Get-Process command is run, there will be no process running with –Id 25400.

Command

PS C:\WINDOWS\system32> Get-Process -Name notepad

Output

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    227      13     2808      13492       0.14   4900   1 notepad

Updated on: 22-Jan-2020

247 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements