title: How to create a hashmap in PowerShell
body: <p>I am attempting to send a hashmap to a Java API in PowerShell.  I need to create a hashmap for one of the inputs required.  I am able to create a hashtable via the following method:</p>
  
  <pre><code>$myMap = @{"name1" = "server1"; "name2" = "server2"}
  </code></pre>
  
  <p>We then echo that and get...</p>
  
  <pre><code>    echo $mymap
  System.Collections.Hashtable
  </code></pre>
  
  <p>How can I convert the System.Collections.Hashtable object to a hashmap within Powershell?  Attempting to send it as a hashtable returns this error:</p>
  
  <pre><code>Cannot convert argument "in0", with value: "System.Collections.Hashtable", for "search" to type "SiteScope.Map": "Cannot create object of type "SiteScope.Map". The path property was not found for the SiteScope.Map object. The available property is: [item &lt;SiteScope.mapItem[]&gt;]" At line:6 char:5 +     $ssWs.search($myMap,"5","$strUsername", "$strPassword","1") +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : NotSpecified: (:) [], MethodException
  + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument
  </code></pre>
  
  <p>"SiteScope" is the Java application with the API.</p>