title: Get values from 2 arrays
body: <p>Maybe the header is wrong but i dont know how to explain.
  I have 4 csv files with aprox 15000 rows in each looking like this</p>
  <p>number,&quot;surname&quot;,&quot;forename&quot;,&quot;emailAddress&quot;,&quot;taxIdentifier&quot;
  100238963,&quot;Smith&quot;,&quot;John&quot;,&quot;john.smith@gmail.com&quot;,&quot;xxxxxxxxxxxx&quot;</p>
  <p>Im reading in 9999 of the rows and creating a json file we use on a site to check every person, we then get a respond back for most of the users, and that respons is &quot;number&quot;
  Then i need to find all them persons in the first array.
  I have done it like this today, but it take to much time to check every person like this, is there any better way of doing this?</p>
  <p>This is the code for getting the persons from the file and create json file:</p>
  <pre><code>$Files = Get-ChildItem -Path &quot;$Folders\\*&quot; -Include *.csv -Force
  
  foreach ($File in $Files){
      $fname = $file
      $fname = (Split-Path $File.name -leaf).ToString().Replace(&quot;.csv&quot;, &quot;&quot;)
      $Savefile = $fname+ &quot;_Cleaned.csv&quot;
  
          $users = Import-Csv $File
          $body = &quot;{`&quot;requestId`&quot;: `&quot;144x25`&quot;,`&quot;items`&quot;: [&quot;
   
  $batchSize = 9999
  $batchNum = 0
  $row = 0
  while ($row -lt $users.Count) {
      $test = $users[$row..($row + $batchSize - 1)]
  
  foreach ($user in $test) {
  
      $nr = $user.number
      $tax = $user.taxIdentifier
      $body += &quot;{`&quot;itemId`&quot;: `&quot;$nr`&quot;,`&quot;subjectId`&quot;: `&quot;$tax`&quot;},&quot;
  }
  </code></pre>
  <p>And then this is the code to deal with the respons:</p>
  <pre><code>       $Result = @()
  
  foreach ($1 in $response.allowedItemIds)
  {
      foreach ($2 in $Users){
  
          If ($2.number -like $1)
          {
              $Result += [pscustomobject]@{
              number = $2.number
              Surname = $2.surname
              Forename = $2.forename
              Email = $2.emailaddress
              Taxidendifier = $2.taxIdentifier
  
          }
      }
  
  }
  
  }
  $Result | Export-Csv -path &quot;$folders\$savefile&quot; -NoTypeInformation -Append
      $row += $batchSize
      $batchNum++
  </code></pre>
  <p>Hope someone has any ideas</p>
  <p>Cheers</p>