title: Powershell: Filter Hashtable - and get back a Hastable
body: <p>Filtering a Hashtable using GetEnumerator always returns a object[] instead of a Hashtable:</p>
  
  <pre><code># Init Hashtable
  $items = @{ a1 = 1; a2 = 2; b1 = 3; b2 = 4}
  # apply a filter
  $filtered = $items.GetEnumerator() | ?{ $_.Key -match "a.*" }
  # The result looks great
  $filtered
    Name                           Value
    ----                           -----
    a2                             2
    a1                             1
  # … but it is not a Hashtable :-(
  $filtered.GetType()
    IsPublic IsSerial Name                                     BaseType
    -------- -------- ----                                     --------
    True     True     Object[]                                 System.Array
  </code></pre>
  
  <p>Is there a nice solution to this problem?</p>
  
  <p>Thanks a lot for any Help!,
  kind regards, 
  Tom</p>