PowerShell get-process cmdlet

On a Microsoft Windows system, you can obtain a list of all processes that are currently running from a command line interface (CLI) using the Windows PowerShell cmdlet get-process. To see all running processes, obtain a PowerShell prompt and type get-process.

PS C:\> get-process

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
    100       9     1472        848    71    14.06  41452 adb
1018385      17     3028       1008    99 5,303.64 101076 AdobeARM
     79       7     1200       1336    44           56112 armsvc
    127      10     7956       9444    37   101.42 120812 audiodg
   9244     279   233224      22368  1019            1916 avp
   1334      72    51656       3436   263 1,856.22  11692 avp
    427      34    18864      11000  1510            1984 certsrv
    321      29    52752      71604   501     3.73   6524 chrome
    249      25    44344       9356   290   801.09   7820 chrome
<text snipped>
    268      20     4876      11112    60          121708 w3wp
    227      21   618252      31084   688            5428 wbengine
     84       8      892        324    41             656 wininit
    181      10     2432       2752    58             684 winlogon
    364      44    13596      17920   153 2,894.47 102896 WinSCP
   1672      20     9228      18008    81           52428 WmiPrvSE
   4884      20    16476       8936    61            3252 WSSBackup


PS C:\>

The column values are as follows:

The "CPU(s)" value is the number of seconds the process has utilized the CPU. A higher number for one process than another doesn't mean the process with the higher number is currently using a greater percentage of the CPU time. The number shows accumulated CPU time in seconds. If process x has a higher number than process y, it may only be due to process x running longer than y. E.g., process x could have been running for a week while process y has been running only for 5 minutes. Process y may have a lower number in the "CPU(s)" column, but currently be using a higher percentage of the CPU time.

If you want to display information only for one application, you can use the -Name parameter. E.g., if I only wanted information on Microsoft Excel:

PS C:\> get-process -Name Excel

Handles  NPM(K)    PM(K)      WS(K) VM(M)   CPU(s)     Id ProcessName
-------  ------    -----      ----- -----   ------     -- -----------
   2521     132   274264     137056  1324 4,778.14   9020 EXCEL


PS C:\>

If you want to see the location of the executable file associated with the process, e.g., in the case above, if I wanted to see the location of excel.exe, which has process id (PID) 9020, I could add -FileVersionInfo at the end of the command.

PS C:\> get-process -Name Excel -FileVersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
15.0.4737.1000   15.0.4737.1000   C:\Program Files\Microsoft Office 15\Root\Office15\EXCEL.EXE

The command also displays the version of the program that is running, i.e., 15.0.4737.100 in this case, which corresponds to Excel 2013.

To obtain help on the command, type help get-process at a PowerShell prompt:

PS C:\> help get-process

NAME
    Get-Process

SYNTAX
    Get-Process [[-Name] <string[]>] [-ComputerName <string[]>] [-Module] [-FileVersionInfo]  [<CommonParameters>]

    Get-Process -Id <int[]> [-ComputerName <string[]>] [-Module] [-FileVersionInfo]  [<CommonParameters>]

    Get-Process -InputObject <Process[]> [-ComputerName <string[]>] [-Module] [-FileVersionInfo]  [<CommonParameters>]


ALIASES
    gps
    ps


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 Get-Process -Online" or
           go to http://go.microsoft.com/fwlink/?LinkID=113324.




PS C:\>

Related articles:

  1. Using PowerShell to obtain process information
  2. Attempting to kill unkillable processes
  3. Obtaining a list of running processes and their associated PIDs

References:

  1. Documenting CPU Load for Running Processes
    PowerShell.com
  2. PowerShell Get-Process – Managing processes
    By: Timothy Warner
    Date: May 1, 2015
    4sysops

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px