Home » PowerShell » PowerShell Get-Process User Name and Details

PowerShell Get-Process User Name and Details

The Get-Process cmdlet in PowerShell gets the list of active processes on the local computer. It has -IncludeUserName that is used to get the process user name.

To get the process user name along with other process details like its process name, id, etc.., run the PowerShell terminal with Administrator privileges.

PowerShell Get-Process UserName
PowerShell Get-Process UserName

In this article, we will discuss how to get the process owner name and other details using the Get-Process cmdlet in PowerShell.

Get-Process Username in PowerShell

Open the PowerShell terminal with elevated privileges and run the Get-Process cmdlet in combination with its parameter -IncludeUserName to get the process owner name.

Get-Process -Name powershell -IncludeUserName

In the above PowerShell script, the Get-Process cmdlet uses the Name parameter to specify the process name “powershell” and the IncludeUserName parameter to get the process username under which the current process is running.

The output of the above PowerShell script gets the process username, processname, Id, and Handles as given below:

PS C:\> Get-Process -Name powershell -IncludeUserName                                                                                                                                        
Handles      WS(K)   CPU(s)     Id          UserName               ProcessName
-------             -----      ------         --                --------                      -----------
    838       8496       55.89     76204         admin                    powershell
   1184      38336    26.50     111380       admin                    powershell

List All Process and Process Owner

To get the list of all active process owner names on the local computer, use the Get-Process cmdlet in combination with its parameter IncludeUserName.

Get-Process -IncludeUserName 

In the above PowerShell script, the Get-Process cmdlet without any parameters gets all the processes on the computer and the IncludeUserName parameter is used to get the process owner name.

The output of the above script to get all processes owner name is:

PS C:\> Get-Process -IncludeUserName                                                                                                                                                         
Handles      WS(K)   CPU(s)     Id          UserName               ProcessName
-------      -----   ------     --                                --------               -----------
    888      25476 ...53.69  10616          NT AUTHORITY\SYSTEM    acumbrellaagent
    169        472 5,843.78   7484           admin                                   ApMsgFwd
    176       2156     4.22  11880            admin                                   ApntEx
    328       3444   642.27    900            admin                                   Apoint
    331        588    80.50  12888            admin                              ApplicationFrameHost
    152         12     0.28   9272                admin                                   ApRemote
    160        668     0.67  97272             NT AUTHORITY\SYSTEM    armsvc
    180       1076     7.38   4996             NT AUTHORITY\SYSTEM    atashost
    844       7420   392.22  17780         admin                                    atmgr
    243         12     1.33  92204              admin                                    bash
    389      33688   229.66   4440         admin                                    brave
    598     140852   128.41   5012        admin                                    brave

Cool Tip: How to stop the process in PowerShell!

Conclusion

I hope the above article on how to get a process user name in PowerShell using the Get-Process cmdlet is helpful to you.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.