title: Get list of processes same as in task manager in powershell console
body: <p>I'm trying to get same list of process as in Task Manager in Windows 2008 server </p>
  
  <p><a href="https://i.stack.imgur.com/zOf9f.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zOf9f.png" alt="enter image description here"></a></p>
  
  <p>I can't get some values even from WMI objects, such as CPU time, UAC Virtualisation, User Name (e.g. process owner), User Objects, CPU Usage, all memory columns, Handles and threads.</p>
  
  <p>Here is some piece of code I made trying to make it work</p>
  
  <pre><code>Clear-Host
  
  $Processes = Get-Process
  foreach ($Process in $Processes) {
  $PIDN = $Process.Id
  $NAMEProcess = $Process.Name
  $NAME  = (Get-WmiObject Win32_Process | where {$_.Name -match $NAMEProcess}).Name
  $PATH  = (Get-WmiObject Win32_Process | where {$_.Name -match $NAMEProcess}).Path
  $CMD   = (Get-WmiObject Win32_Process | where {$_.Name -match $NAMEProcess}).CommandLine
  
  $OWNER = (Get-WmiObject win32_process | where {$_.Name -match $NAMEProcess}).getowner().user
  $SESSIONID = (Get-WmiObject Win32_Process | where {$_.Name -match $NAMEProcess}).SessionId
  $CPU = $Process.CPU
  $WORKINGSET64 = $Process.WorkingSet64
  $PEAKWORKINGSET64 = $Process.PeakWorkingSet64
  $THREADS = $Process.Threads.Count
  $HANDLES = $Process.Handles
  $DESCRIPTION = $Process.Description
  
  $obj = new-object psobject
  $obj | add-member noteproperty "PID" ($PIDN)
  $obj | add-member noteproperty "NAME" ($NAME)
  $obj | add-member noteproperty "OWNER" ($OWNER)
  $obj | add-member noteproperty "PATH" ($PATH)
  $obj | add-member noteproperty "Command Line" ($CMD)
  $obj | Add-Member noteproperty "SessionID" ($SESSIONID)
  $obj | Add-Member noteproperty "CPU" ($CPU)
  $obj | Add-Member noteproperty "WorkingSet64" ($WORKINGSET64)
  $obj | Add-Member noteproperty "Peak Working Set64" ($PEAKWORKINGSET64)
  $obj | Add-Member noteproperty "HANDLES" ($HANDLES)
  $obj | Add-Member noteproperty "THREADS" ($THREADS)
  $obj | Add-Member noteproperty "DESCRIPTION" ($DESCRIPTION)
  
  write-output $obj | Format-Table
  # $obj | Format-Table $PIDN, $NAME
  }
  </code></pre>
  
  <p>Also couldn't make it to output in proper table. Could you please help me with that? Thank you.</p>