title: how to get process id of a running process as shown in task manager
body: <p>I am learning powershell and trying to see how can variables and functions could be used. I want to print out PID for all running notepad instances, basically what is shown in PID column under Details tab in Task manager. I have written following code </p>
  
  <pre><code>$cmd = {
    param($abc)
    Write-Host $abc
  }
  
  $processes = Get-Process -Name notepad | Select -ExpandProperty ID 
  foreach ($process in $processes) 
  { 
      Start-Job -ScriptBlock $cmd -ArgumentList $process
  }
  </code></pre>
  
  <p>I am getting following result.</p>
  
  <pre><code>Id     Name            PSJobTypeName   State         HasMoreData     Location             Command                  
  --     ----            -------------   -----         -----------     --------             -------                  
  50     Job50           BackgroundJob   Running       True            localhost            ...                      
  52     Job52           BackgroundJob   Running       True            localhost            ...                      
  </code></pre>
  
  <p>Two issues here.<br>
  1. I only want PID, it has whole lot.<br>
  2. I expect that Id in above output is the PID but what is shown in task manager is very differnt.  </p>
  
  <p>Can you tell me what am I doing wrong?</p>