title: How to implement a parallel jobs and queues system
body: <p>I spent days trying to implement a parallel jobs and queues system, but... I tried but I can't make it. Here is the code without implementing nothing, and CSV example from where looks.</p>
  
  <p>I'm sure this post can help other users in their projects.</p>
  
  <p>Each user have his pc, so the CSV file look like:</p>
  
  <pre><code>pc1,user1
  pc2,user2
  pc800,user800 
  </code></pre>
  
  <p>CODE:</p>
  
  <pre><code>#Source File:
  $inputCSV = '~\desktop\report.csv'
  $csv = import-csv $inputCSV -Header PCName, User
  echo $csv #debug
  
  #Output File:
  $report = "~\desktop\output.csv"
  
  #---------------------------------------------------------------
  
  #Define search:
  $findSize = 40GB
  Write-Host "Lonking for $findSize GB sized Outlook files"
  
  #count issues:
  $issues = 0 
  
  #---------------------------------------------------------------
  
  foreach($item in $csv){
  
      if (Test-Connection -Quiet -count 1 -computer $($item.PCname)){
  
          $w7path = "\\$($item.PCname)\c$\users\$($item.User)\appdata\Local\microsoft\outlook"
  
          $xpPath = "\\$($item.PCname)\c$\Documents and Settings\$($item.User)\Local Settings\Application Data\Microsoft\Outlook"
  
              if(Test-Path $W7path){
  
                  if(Get-ChildItem $w7path -Recurse -force -Include *.ost -ErrorAction "SilentlyContinue" | Where-Object {$_.Length -gt $findSize}){
  
                      $newLine =  "{0},{1},{2}" -f $($item.PCname),$($item.User),$w7path
                      $newLine |  add-content $report
  
                      $issues ++
                      Write-Host "Issue detected" #debug
                      }
              }
  
              elseif(Test-Path $xpPath){
  
                  if(Get-ChildItem $w7path -Recurse -force -Include *.ost -ErrorAction "SilentlyContinue" | Where-Object {$_.Length -gt $findSize}){
  
                      $newLine =  "{0},{1},{2}" -f $($item.PCname),$($item.User),$xpPath
                      $newLine |  add-content $report
  
                      $issues ++
                      Write-Host "Issue detected" #debug
                      }
              }
  
              else{
                  write-host "Error! - bad path"
              }
      }
  
      else{
          write-host "Error! - no ping"
      }
  }
  
  Write-Host "All done! detected $issues issues"
  </code></pre>