title: How to fix "Collection was modified; enumeration operation may not execute in powershell"
body: <p>I'm trying to insert a variable with multiple values into another variable to add the values to a table. But the enumeration operation won't execute</p>
  
  <p>I've tried making arrays, arraylists, but nothing has worked</p>
  
  <pre><code>[guid]$subscriptionId = "blank for example" 
  [guid]$tenantId = "blank for example" 
  
  
  Select-AzureRmSubscription -SubscriptionId $subscriptionId
  
  $resgrp = Get-AzureRmResourceGroup | select ResourceGroupName,Location
  foreach ($res in $resgrp)
  {
      $timestmp = Get-AzureRmResourceGroupDeployment -ResourceGroupName $res.ResourceGroupName | select Timestamp
      $resgrp.Add($timestmp)
  }
  </code></pre>
  
  <p>I expect to see a formatted table with:</p>
  
  <pre><code>ResourceName   Location  Timestamp
  ------------   --------  ---------
  etc.           etc.      etc.
  </code></pre>