title: Not able to get values from HashTable in Powershell
body: <p>I am new to Powershell. I have written a query and I am getting two columns from the query. What I want is Key = Col1 and Value = Col2. I am able to print the whole Hashtable, but I am not able to get the value in the format Col1['Col2] = x. Below is my code:</p>
  <pre><code>$query1 = &quot;select top 5 Col1, Col2 from TableName&quot;
  $databases1 = Invoke-Sqlcmd -Query $query1 -ConnectionString &quot;ConnectionString&quot;    
  $hash = @{$databases1.Col1 = $databases1.Col2}
  return $hash
  </code></pre>
  <p>The variable $hash returns as below:</p>
  <pre><code>Name                Value                                                                                                                                                                                           
  ----                -----                                                                                                                                                                                           
  {a, b, c,...{1, 2, 3, 4...} 
  </code></pre>
  <p>But I want to access it as <code>$hash['a'] = 1</code>
  Can anyone please help me out?</p>