title: PowerShell output contents of hash to file
body: <p>I have code to output a sorted hashtable to the screen:</p>
  
  <pre><code>$h.getenumerator() | sort value -descending
  </code></pre>
  
  <p>It looks like this:</p>
  
  <pre><code>Name                           Value
  ----                           -----
  10.10.10.10 69566308           151
  10.10.10.11 69566308           143
  10.10.10.12 69566308           112
  10.10.10.13 69566308            99
  10.10.10.14 69566308            71
  10.10.10.15 69566308            70
  </code></pre>
  
  <p>But I would like to output this to a file instead.</p>
  
  <p>When I try to output to a file with</p>
  
  <pre><code>$h.getenumerator() | sort value -descending | out-string | Add-Content D:\Script\iis_stats.log
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$h.getenumerator() | sort value -descending | Add-Content D:\Script\iis_stats.log
  </code></pre>
  
  <p>All I get is "System.Collections.DictionaryEntry" in <code>D:\Script\iis_stats.log</code>.</p>
  
  <p>How do I fix it?</p>