PowerShell Logo Small

Get-Process



This is the built-in help made by Microsoft for the command 'Get-Process', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the processes that are running on the local computer or a remote computer.

SYNTAX


Get-Process [[-Name] [<String[]>]] [-ComputerName [<String[]>]] [-FileVersionInfo] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}]
[-InformationVariable [<System.String]>]] [-Module] [<CommonParameters>]
Get-Process [-ComputerName [<String[]>]] [-FileVersionInfo] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String]>]] [-Module] -InputObject <Process[]> [<CommonParameters>]
Get-Process [-ComputerName [<String[]>]] [-FileVersionInfo] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable
[<System.String]>]] [-Module] -Id <Int32[]> [<CommonParameters>]
Get-Process [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]] -Id <Int32[]> -IncludeUserName
[<CommonParameters>]
Get-Process [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]] -IncludeUserName -InputObject
<Process[]> [<CommonParameters>]
Get-Process [[-Name] [<String[]>]] [-InformationAction {SilentlyContinue | Stop | Continue | Inquire | Ignore | Suspend}] [-InformationVariable [<System.String]>]]
-IncludeUserName [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-Process cmdlet gets the processes on a local or remote computer.


Without parameters, Get-Process gets all of the processes on the local computer. You can also specify a particular process by process name or process ID (PID) or pass a
process object through the pipeline to Get-Process.


By default, Get-Process returns a process object that has detailed information about the process and supports methods that let you start and stop the process. You can also
use the parameters of Get-Process to get file version information for the program that runs in the process and to get the modules that the process loaded.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=290498
Debug-Process
Get-Process
Start-Process
Stop-Process
Wait-Process

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>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 the "Additional Notes" section of the Help topic
for Get-Help.










-------------------------- EXAMPLE 2 --------------------------

PS C:\>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-List cmdlet, 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 --------------------------

PS C:\>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-Object cmdlet, 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 --------------------------

PS C:\>$a = get-processPS C:\>get-process -inputobject $a | format-table -view priority



These commands list the processes on the computer in groups based on their priority class. The first command gets all the processes on the computer and then stores them in
the $a variable.

The second command uses the InputObject parameter to pass the process objects that are stored in the $a variable to the Get-Process cmdlet. The pipeline operator passes the
objects to the Format-Table cmdlet, which formats the processes by using the Priority view. The Priority view, and other views, are defined in the PS1XML format files in the
Windows PowerShell home directory ($pshome).






-------------------------- EXAMPLE 5 --------------------------

PS C:\>get-process powershell -computername S1, localhost | ft @{Label="NPM(K)";Expression={[int]($_.NPM/1024)}},
@{Label="PM(K)";Expression={[int]($_.PM/1024)}},@{Label="WS(K)";Expression={[int]($_.WS/1024)}},@{Label="VM(M)";Expression={[int]($_.VM/1MB)}},
@{Label="CPU(s)";Expression={if ($_.CPU -ne $()) { $_.CPU.ToString("N")}}}, Id, MachineName, ProcessName -auto

NPM(K) PM(K) WS(K) VM(M) CPU(s) Id MachineName ProcessName
------ ----- ----- ----- ------ -- ----------- -----------
6 23500 31340 142 1980 S1 powershell
6 23500 31348 142 4016 S1 powershell
27 54572 54520 576 4428 localhost powershell



This example provides a Format-Table (alias = ft) command that adds the MachineName property to the standard Get-Process output display.






-------------------------- EXAMPLE 6 --------------------------

PS C:\>get-process powershell -fileversioninfo

ProductVersion FileVersion FileName
-------------- ----------- --------
6.1.6713.1 6.1.6713.1 (f... C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe



This command uses the FileVersionInfo parameter to get the version information for the PowerShell.exe file that is the main module for the PowerShell process.

To run this command with processes that you do not own on Windows Vista and later versions of Windows, you must open Windows PowerShell with the "Run as administrator"
option.










-------------------------- EXAMPLE 7 --------------------------

PS C:\>get-process sql* -module



This command uses the Module parameter to get the modules that have been loaded by the process. This command gets the modules for the processes that have names that begin
with "sql".

To run this command on Windows Vista (and later versions of Windows) with processes that you do not own, you must start Windows PowerShell with the "Run as administrator"
option.










-------------------------- EXAMPLE 8 --------------------------

PS C:\>$p = get-wmiobject win32_process -filter "name='powershell.exe'"
PS C:\>$p.getowner()

__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 3
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
Domain : DOMAIN01
ReturnValue : 0
User : user01



This command shows how to find the owner of a process. Because the System.Diagnostics.Process object that Get-Process returns does not have a property or method that returns
the process owner, the command uses

the Get-WmiObject cmdlet to get a Win32_Process object that represents the same process.

The first command uses Get-WmiObject to get the PowerShell process. It saves it in the $p variable.

The second command uses the GetOwner method to get the owner of the process in $p. The command reveals that the owner is Domain01\user01.










-------------------------- EXAMPLE 9 --------------------------

PS C:\>get-process powershell

Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
308 26 52308 61780 567 3.18 5632 powershell
377 26 62676 63384 575 3.88 5888 powershellPS C:\>get-process -id $pid
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
396 26 56488 57236 575 3.90 5888 powershell



These commands show how to use the $pid automatic variable to identify the process that is hosting the current Windows PowerShell session. You can use this method to
distinguish the host process from other Windows PowerShell processes that you might want to stop or close. The first command gets all of the Windows PowerShell processes in
the current session.

The second command gets the Windows PowerShell process that is hosting the current session.






-------------------------- EXAMPLE 10 --------------------------

PS C:\>get-process | where {$_.mainWindowTitle} | format-table id, name, mainwindowtitle -autosize



This command gets all the processes that have a main window title, and it displays them in a table with the process ID and the process name.

The mainWindowTitle property is just one of many useful properties of the System.Diagnostics.Process object that Get-Process returns. To view all of the properties, pipe the
results of a Get-Process command to the T:Microsoft.PowerShell.Commands.Get-Member cmdlet (get-process | get-member).