title: How do you pass a hash table to a function in PowerShell?
body: <p>When passing a hash table to my PowerShell function, it complains that it receives an object.</p>
  
  
  
  <pre class="lang-powershell prettyprint-override"><code>Function ExtendHash(){
    param(
      [hashtable] $source,
      [hashtable] $extender
    )
    ...
  }
  </code></pre>
  
  <p>And the caller:</p>
  
  <pre class="lang-powershell prettyprint-override"><code>$hash1 = @{One = 1; Two = 2}
  $hash2 = @{Two = 22; three = 3}
  ExtendHash($hash1, $hash2)
  </code></pre>
  
  <blockquote>
    <p>Cannot convert the System.Object[] value of type System.Object[] to type System.Collection.Hashtable</p>
  </blockquote>
  
  <p>So how do I make this work? Suggestions?</p>
  
  <p>Also, am I missing something built-in? I want the same pattern as what JavaScript uses to extend default options (merge and override default values).</p>