title: remove empty keys powershell
body: <p>I'm trying to remove all keys that are empty from my hash using this code:</p>
  
  <pre><code>foreach ($key in $OUHash.Keys){
      if ($($OUHash.Item($key)) -eq $NULL) {
          $OUHash.Remove($key)
      }
  }
  </code></pre>
  
  <p>This removes one empty key, but not all, it also gives me this error message:</p>
  
  <pre><code>Collection was modified; enumeration operation may not execute.
  At C:\AD\Shadow group Sync.ps1:31 char:10
  + foreach ($key in $Hash.Keys){
  +          ~~~~
      + CategoryInfo          : OperationStopped: (:) [], InvalidOperationException
      + FullyQualifiedErrorId : System.InvalidOperationException
  </code></pre>