Finding Process Owners and Sessions

by Oct 4, 2012

Get-Process returns a lot of information about running tasks but it does not return the process owners or the session a process is logged on to. There are built-in console tools like tasklist that do provide this information. By asking these tools to output their information as comma-separated values, PowerShell can pick up the information and make it reusable with your scripts:

PS> tasklist /V /FO CSV | ConvertFrom-Csv | Out-GridView

For example, to get a list of tasks, their session and the process owner, try this:

PS> tasklist /V /FO CSV | ConvertFrom-Csv | Select-Object -Property 'Image Name', 'Session Name', 'Session#', 'User Name'

Unfortunately, the column names of most console-based tools are localized, so unless you are using an English system, you probably have to adjust the column names appropriately.

Twitter This Tip! ReTweet this Tip!