Get Process (Microsoft.PowerShell.Management) – PowerShell (2023)

  • Relation
Module:
Microsoft.PowerShell.Administration

Gets the processes running on the local computer.

Syntax

Get-Process [[-Name] <String[]>] [-Modul] [-FileVersionInfo] [<CommonParameters>]
Get-Process [[-Name] <String[]>] -IncludeUserName [<CommonParameters>]
Get-Process -Id <Int32[]> [-Modul] [-FileVersionInfo] [<Allgemeine Parameter>]
Get-Process -Id <Int32[]> -IncludeUserName [<CommonParameters>]
Get-Process -InputObject <Process[]> [-Module] [-FileVersionInfo] [<Common Parameters>]
Get-Process -InputObject <Processo[]> -IncludeUserName [<Common Parameters>]

description

Isget processcmdlet gets the processes on a local or remote computer.

With no parameters, this cmdlet gets all processes on the local computer. You can also specify a specific process by process name, process identifier (PID), or pipe a process object to this cmdlet.

By default, this cmdlet returns a process object that contains detailed information about the process and supports methods that you can use to start and stop the process. You can also use the parameters of theget processCmdlet to get file version information of the program running in the process and to get the modules that the process has loaded.

examples

Example 1: Get a list of all running processes on the local computer

get process

This command gets a list of all active processes running on the local computer. For a definition of each column, seeNutsSection.

Example 2: Get all available data on one or more processes

Get Process Winword Explorer | list format *

This command retrieves all available data about the Winword and Explorer processes on the computer. use theName-Parameter to specify the processes, but omits the name of the optional parameter. The pipe operator (|) passes the data to theFormat-ListCmdlet that shows all available properties (*) of the Winword and Explorer process objects.

You can also identify processes by their process IDs. For example,Get the process ID 664, 2060.

Example 3: Get all processes with a working set larger than a specified size

Obtener-Prozess | Where-Object {$_.WorkingSet -gt 20000000}

This command gets all processes that have a working set greater than 20MB. use theget processCmdlet to get all running processes. The pipe operator (|) passes the process objects to thewhere objectCmdlet that selects only the object with a value greater than 20,000,000 bytes for theWorkingsetProperty.

Workingsetit is one of many properties of process objects. To view all properties, typeGet Process | become a member. By default, the values ​​of all set properties are in bytes, although the default display shows them in kilobytes and megabytes.

Example 4: List of processes on the computer in groups by priority

$A = Get-Process$A | Get Process | Format table -Show priority

These commands list the processes on the computer into groups based on their priority class. The first command gets all the processes on the computer and then saves them to the$AVariable.

The second command directs theprocedureObject stored in the$Avariable to theget processcmdlet, then toformat tableCmdlet that formats processes usingpriorityOutlook.

IspriorityView and other views are defined in PS1XML format files in the PowerShell root directory ($pshome).

Example 5: Add a property to the Get-Process-Stdout screen

Get the pwsh process | Table format ` @{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) {$_.CPU.ToString("N")}}}, ID, process name, start time -AutoSizeNPM(K) PM(K) WS(K) VM(M) CPU( ;s) Process ID Name Start Time------ ----- ----- ----- ------ -- ----------- - - --- 2022 07:30:52 |

This example gets processes from the local computer. The recovered processes are directed to theformat tableCommand that adds thestart timeproperty of the normget processoutput screen.

Example 6: Retrieving version information for a process

Get-Process pwsh -FileVersionInfoProductVersion FileVersion FileName-------------- ----------- --------6.1.2 6.1.2 C:\ Programmarchiv\PowerShell\6\pwsh.exe

This command uses theFile version informationParameter to get information about the version of thepwsh.exeFile that is the main module for the PowerShell process.

In Windows Vista and later versions of Windows, to run this command on processes that you do not own, you must open PowerShell with theExecute as administratorPossibility.

Example 7: Get modules loaded with the specified process

Get-SQL Process* -Modul

This command uses theModuleto let the process load the modules. This command gets the modules for processes whose names start withsql.

To run this command on Windows Vista and later versions of Windows with processes you don't recognize, you need to start PowerShell withExecute as administratorPossibility.

Example 8: Find the owner of a process

Get-Process pwsh -IncludeUserNameHandles WS(K)-CPU(s)-ID Username Process Name------- ----- ------ -- -------- --- ------ 782 132080 2.08 2188 DOMINIO01\usuario01 pwsh

This command shows how to find the owner of a process. On Windows it isInclude usernameThe parameter requires elevated user rights (Execute as administrator). The output shows that is the ownerDomain01\usuario01.

Example 9: Using an automatic variable to identify the process hosting the current session

Get-Process pwshNPM(K) PM(M) WS(M) CPU(s) ID SI ProcessName------ ----- ----- ------ -- -- -- --------- 83 96,21 105,95 4,33 1192 10 pwsh 79 83,81 117,61 2,16 10580 10 pwshGet-Process -Id $PIDNPM(K) PM(M) WS( M) CPU(s) Id SI ProcessName--- --- ----- ----- ------ -- -- ----------- 83 96,21 77,53 4,39 1192 10 pwsh

These commands show how to use them$PIDAutomatic variable to identify the process hosting the current PowerShell session. You can use this method to distinguish the host process from other PowerShell processes that you want to kill or close.

The first command gets all PowerShell processes in the current session.

The second command gets the PowerShell process hosting the current session.

Example 10: Get all processes that have a parent window title and display them in a table

Get Process | Where-Object {$_.mainWindowTitle} | Format ID table, name, title of the main window - automatic size

This command gets all processes that have a parent window title and displays them in a table by process id and name.

IsMain window titleThe property is just one of many useful properties of theprocedurecontradictget processreturns. To see all properties, pipe the results of aget processI command thembecome a membercmdletGet Process | become a member.

Parameter

-File version information

Specifies that this cmdlet retrieves the file version information of the program running in the process.

On Windows Vista and later versions of Windows, you must open PowerShell with theExecute as administratorOption to use this parameter in processes you don't own.

To get file version information for a process on a remote computer, use theInvoke commandcmdlet.

Using this parameter is equivalent to gettingMainModule.FileVersionInfoProperty of each process object. If you use this parameter,get processreturns aFile version informationObjectSystem.Diagnostics.FileVersionInfo, not a process object. Therefore, you cannot pipe the output of the command to a cmdlet that expects a process object, such asstop process.

writes:SwitchParameter
Alias:FV, FVI
Position:On behalf of
Default value:Neither
Accept pipeline input:NOT CORRECT
Accept wildcards:NOT CORRECT

-I WOULD

Identifies 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, typeget process.

writes:Int32[]
Alias:PID
Position:On behalf of
Default value:Neither
Accept pipeline input:RIGHT
Accept wildcards:NOT CORRECT

-Include username

Indicates that the UserName value of theprocedurethe object with the results of the command is returned.

writes:SwitchParameter
Position:On behalf of
Default value:Neither
Accept pipeline input:NOT CORRECT
Accept wildcards:NOT CORRECT

-input object

Specifies one or more process objects. Enter a variable that contains the objects or write a command expression that gets the objects.

writes:procedure[]
Position:On behalf of
Default value:Neither
Accept pipeline input:RIGHT
Accept wildcards:NOT CORRECT

-Module

Indicates that this cmdlet retrieves the modules loaded by processes.

On Windows Vista and later versions of Windows, you must open PowerShell with theExecute as administratorOption to use this parameter in processes you don't own.

To get the modules loaded by a process on a remote computer, use theInvoke commandcmdlet.

This parameter is equivalent to gettingModuleProperty of each process object. If you use this parameter, this cmdlet returns aprocess moduleObjectSystem.Diagnostics.ProcessModule, not a process object. Therefore, you cannot pipe the output of the command to a cmdlet that expects a process object, such asstop process.

if you use bothModulejFile version informationParameters in the same command, this cmdle gives aFile version informationObject with information about the file version of all modules.

writes:SwitchParameter
Position:On behalf of
Default value:Neither
Accept pipeline input:NOT CORRECT
Accept wildcards:NOT CORRECT

-Name

Specifies one or more processes by process name. You can enter multiple process names (separated by commas) and use wildcards. The name of the parameter (Name) it is optional.

writes:line[]
Alias:name of the process
Position:0
Default value:Neither
Accept pipeline input:RIGHT
Accept wildcards:RIGHT

starter

procedure

You can pipe a process object to this cmdlet.

departures

procedure

By default, this cmdlet returns aSystem.Diagnostics.ProcessObject.

File version information

If you use theFile version informationparameter, this cmdlet returns aFile version informationObject.

process module

If you use theModuleparameters without whichFile version informationparameter, this cmdlet returns aprocess moduleObject.

Nuts

PowerShell includes the following aliases forget process:

  • All platforms:

    • GPS
  • Window:

    • PD
  • You can also reference this cmdlet through its built-in aliases,PDjGPS. For more information, seeabout_Alias.

  • On computers running a 64-bit version of Windows, the 64-bit version of PowerShell only gets 64-bit compute modules and the 32-bit version of PowerShell only gets 32-bit compute modules.

  • You can use Windows Management Instrumentation (WMI) properties and methodswin32_processObject in PowerShell. For information seeGet WmiObjectand the WMI SDK.

  • The default display for a process is a table that contains the following columns. For a description of all process object properties, seeprocess properties.

    • Are you going: The number of handles the process has opened.
    • MNP(N): The amount of non-paged memory used by the process, in kilobytes.
    • clock (K): The amount of pageable memory used by the process, in kilobytes.
    • WS(K): The working set size of the process in kilobytes. The working set consists of the memory pages last referenced by the process.
    • virtual machine (M): The amount of virtual memory used by the process, in megabytes. Virtual memory includes storage in swap files on disk.
    • CPU(s): The amount of processor time the process used across all processors, in seconds.
    • I WOULD: The process ID (PID) of the process.
    • name of the process: The name of the process. For explanations of process-related concepts, see the Glossary in Help and Support Center and Task Manager Help.
  • You can also use the built-in alternate views of available processesformat table, such asstart timejpriorityand you can design your own views.

  • debugging process
  • get process
  • Start progress
  • stop process
  • waiting process
Top Articles
Latest Posts
Article information

Author: Lakeisha Bayer VM

Last Updated: 03/22/2023

Views: 6566

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Lakeisha Bayer VM

Birthday: 1997-10-17

Address: Suite 835 34136 Adrian Mountains, Floydton, UT 81036

Phone: +3571527672278

Job: Manufacturing Agent

Hobby: Skimboarding, Photography, Roller skating, Knife making, Paintball, Embroidery, Gunsmithing

Introduction: My name is Lakeisha Bayer VM, I am a brainy, kind, enchanting, healthy, lovely, clean, witty person who loves writing and wants to share my knowledge and understanding with you.