Get-Process

 

Additional Resources for Get-Process

 

Retrieving Process Information

http://www.microsoft.com/technet/scriptcenter/topics/msh/cmdlets/get-process.mspx

 

 

SYNOPSIS

Gets the processes that are running on the local computer.

 

SYNTAX

Get-Process [[-name] <string[]>] [<CommonParameters>]

 

Get-Process -id <Int32[]> [<CommonParameters>]

 

Get-Process -inputObject <Process[]> [<CommonParameters>]

 

DETAILED DESCRIPTION

The Get-Process cmdlet retrieves a process object for each process. Without parameters, "Get-Process" gets all of the processes on the computer, as though you typed "Get-Process *". You can also identify a particular process by process name or process ID (PID), or pass a process object through the pipeline to Get-Process. For Get-Process, the default method is by process name. For Stop-Process, the default method is by process ID.

 

PARAMETERS

 

-name <string[]>

Specifies one or more processes by process name. You can type multiple process names (separated by commas) or use wildcard characters. The parameter name ("-Name") is optional.

 

Required?

false

Position?

1

Default value

Null

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

true

 

-inputObject <Process[]>

Accepts a process object as input to the cmdlet. Enter a variable that contains the objects or type a command or expression that gets the objects.

 

Required?

true

Position?

named

Default value

Null

Accept pipeline input?  

true (ByValue)

Accept wildcard characters? 

false

 

-id <Int32[]>

Specifies one or more processes by process ID (PID). To specify multiple IDs, use commas to separate the IDs. To find the PID of a process, type "get-process".

 

Required?

true

Position?

named

Default value

Null

Accept pipeline input?  

true (ByPropertyName)

Accept wildcard characters? 

false

 

<CommonParameters>

This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, and -OutVariable. For more information, type, "get-help about_commonparameters".

 

INPUT TYPE

PSObjects with the "ProcessName" or "Id" property specified, or all processes if neither is specified.

 

RETURN TYPE

Process Object(s).

For details, see the .NET framework documentation of the System.Diagnostics.Process class. These objects are sorted by ProcessName, and within ProcessName, by ID.

 

NOTES

 

For more information, type "Get-Help Get-Process -detailed". For technical information, type "Get-Help Get-Process -full".

 

When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

 

You cannot use the -Name, -ID, and -InputObject parameters in the same command.

 

You can also refer to Get-Process by its built-in aliases, "ps" and "gps". For more information, see About_Alias.

 

You can also use the properties and methods of the WMI Win32_Process object in Windows PowerShell. For information, see Get-WmiObjectand the Windows Management Instrument SDK.

 

The default display of a process is a table that includes the following columns:

 

·          Handles: The number of handles that the process has opened.

·          NPM(K): The amount of non-paged memory that the process is using, in kilobytes.

·          PM(K): The amount of pageable memory that the process is using, in kilobytes.

·          WS(K): The size of the working set of the process, in kilobytes. The working set consists of the pages of memory that were recently referenced by the process

·          VM(M): The amount of virtual memory that the process is using, in megabytes. Virtual memory includes storage in the paging files on disk.

·          CPU(s): The amount of processor time that the process has used on all processors, in seconds.

·          ID: The process ID (PID) of the process.

·          ProcessName: The name of the process.

 

For explanations of the concepts related to processes, use the Glossary in Help and Support Center and help for Task Manager.

 

You can also use the built-in alternate views of the processes available with Format-Table, such as "StartTime" and "Priority", and you can design your own views. For more information, type "Get-Help Format-Table -detailed".

 

EXAMPLE 1

 

Get-Process

 

This command gets a list of all of the running processes running on the local computer. For a definition of each column, see Additional Notes in "Get-Help Get-Process -Full."

 

EXAMPLE 2

 

Get-Process winword, explorer | format-list *

 

This command gets all available data about the Winword and Explorer processes on the computer. It uses the Name parameter to specify the processes, but it omits the optional parameter name. The pipeline operator (|) passes the data to the Format-Listcmdlet, which displays all available properties (*) of the Winword and Explorer process objects.

 

You can also identify the processes by their process IDs. For example, "get-process -id 664, 2060".

 

EXAMPLE 3

 

get-process | where-object {$_.WorkingSet -gt 20000000}

 

This command gets all processes that have a working set greater than 20 MB. It uses the Get-Process cmdlet to get all running processes. The pipeline operator (|) passes the process objects to the Where-Objectcmdlet, which selects only the object with a value greater than 20,000,000 bytes for the WorkingSet property.

 

WorkingSet is one of many properties of process objects. To see all of the properties, type "Get-Process | Get-Member". By default, the values of all amount properties are in bytes, even though the default display lists them in kilobytes and megabytes.

 

EXAMPLE 4

 

$a = get-process

 

get-process -inputobject $a | format-table -view priority

 

These commands list the processes on the computer grouped by priority. The first command gets all of the processes on the computer and stores them in the $a variable. The second command uses the InputObject parameter to pass the process objects stored in $a to Get-Process. The pipeline operator passes the objects to the Format-Tablecmdlet, which formats the processes by using the "Priority" view defined in the PS1XML format files in the Windows PowerShell home directory ($pshome).

 

RELATED LINKS

Stop-Process