How to get the specific process(es) information using PowerShell?


  • To find the specific process using Get-Process cmdlet, you need to use the –Name parameter. You can use single and multiple process names.

Command

Get-Process -Name AcroRd32, audiodg

Output

Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
506 27 9888 19216 2.22 6320 1 AcroRd32
632 51 112196 17648 42.95 8052 1 AcroRd32
209 13 10344 17100 13.98 22748 0 audiodg

You can also achieve the same using Where-Object (alias: Where) command.

Get-Process | Where{$_.Name -eq "AcroRd32"}

But to get the multiple processes you need to use the –OR comparison operator.

Get-Process | Where{($_.Name -eq "AcroRd32") -or ($_.Name -eq "AudioDg")}

The result will be the same as displayed above.

  • To get the specific process information using the WMI object, you can use –Filter parameter or pipeline Where-Object command.

    Using the Where-Object command.

Get-WmiObject Win32_Process | Where{($_.Name -eq "AcroRd32.exe") -or ($_. Name -eq "AudioDg.exe")}

Using –Filter parameter.

Get-WmiObject Win32_Process -Filter {Name = 'AcroRD32.exe'}

To get the multiple processes, you need to use AND comparison operator.

Get-WmiObject Win32_Process -Filter {Name = 'AcroRD32.exe' or Name = 'AudioDg.exe'}

Updated on: 22-Jan-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements