title: Wait until all threads complete before running next task
body: <p>I would wrap everything inside <code>foreach($computer in $computers)</code> in a <code>Start-Job</code> to make them run simultaneously. The only problem is, I need to wait for all the jobs to complete before I do the <code>ConvertTo-Json</code> at the bottom.</p>
  
  <pre><code>$sb = "OU=some,OU=ou,DC=some,DC=domain"
  $computers = Get-ADComputer -Filter {(Enabled -eq $true)} -SearchBase "$sb" -Properties *
  $hasmanufacturer = New-Object System.Collections.Generic.List[System.Object]
  foreach($computer in $computers)
  {
      $drives = try{@(Get-WMIObject -Class Win32_CDROMDrive -Property * -ComputerName $computer.Name -ErrorAction Stop)} catch {$null}
      foreach($drive in $drives)
      {
          if($drive.Manufacturer)
          {
              $hasmanufacturer.Add($computer)
              continue
          }
      } # inner foreach
  }
  
  ConvertTo-Json $hasmanufacturer
  </code></pre>