How to stop all instances of the process in PowerShell?

PowerShellMicrosoft TechnologiesSoftware & Coding

To stop running all the instances of the process in PowerShell Stop-Process command is used. For example, in the below example, we have two running instances of notepad.exe process.

Command

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

Output

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

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
    228      13     3160      13448       0.14  15564   1 notepad
    228      14     3148      13668       0.17  22644   1 notepad

To stop all the instances of the running process, below command will be used.

Stop-Process -Name notepad

You can also pipeline the Stop-Process to end the process.

Get-Process -Name notepad | Stop-Process

To stop multiple processes, provide different process names separated by comma (,)

Get-Process SkypeApp,notepad |Stop-Process -Confirm:$false
raja
Published on 22-Jan-2020 16:55:26
Advertisements