title: Powershell foreach (list the array item command referenced)
body: <p>I've search high and low with no luck.<br>
  Using a foreach against an array, after running a command against each of the array items I am not sure which array item the results are from. </p>
  
  <p>I've attempted many variations. This code is the best example of what I have attempted.</p>
  
  <pre><code>$ADGroupVar = @(
  'ADGroup1'
  'ADGroup2'
  'ADGroup3'
  );
  
  foreach ($ADgrouplist in $ADGroupVar)
  {
  Write-Host $ADgrouplist
  Get-ADGroupMember ($ADgrouplist) | select name
  }
  
  ADGroup1
  ADGroup2
  ADGroup3
  
  Computer5
  Computer10
  Computer2
  Computer4
  Computer20
  Computer3
  Computer1
  </code></pre>
  
  <hr>
  
  <p>Desired results are:</p>
  
  <p>ADGroup1 <br> 
  Computer5 <br> 
  Computer10 <br> 
         ADGroup2 <br> 
         Computer2 <br> 
         Computer4 <br> 
         Computer20 <br> 
         ADGroup3 <br> 
         Computer3 <br> 
         Computer1 <br> </p>
  
  <p>or <br></p>
  
  <p>Computer5 ADGroup1 <br>
  Computer10 ADGroup1 <br>
  <b>...</b></p>