title: Getting the current hash key in a ForEach-Object loop in powershell
body: <p>I've got a hash table: </p>
  
  <pre class="lang-sh prettyprint-override"><code>$myHash = @{ 
     "key1" = @{
         "Entry 1" = "one"
         "Entry 2" = "two"
     }
     "key 2" = @{
         "Entry 1" = "three"
         "Entry 2" = "four"
     }
  }
  </code></pre>
  
  <p>I'm doing a loop through to get the objects: </p>
  
  <pre class="lang-sh prettyprint-override"><code>$myHash.keys | ForEach-Object {
      Write-Host $_["Entry 1"]
  }
  </code></pre>
  
  <p>Works fine, but what can I use to figure out which of the keys of <code>$myHash</code> I'm in? <code>$_.Name</code> doesn't return anything. I'm stumped. Help? </p>