PowerShell Hash Tables Double Key Error: "a" and "A" PowerShell Hash Tables Double Key Error: "a" and "A" powershell powershell

PowerShell Hash Tables Double Key Error: "a" and "A"


By default PowerShell Hash tables are not case sensitive.Try this

$h = new-object System.Collections.Hashtable$h['a'] = "Entry for a"$h['A'] = "S.th.else for A"$h[0] = "Entry for 0"$h[1] = "Entry for 1"$h

Or this (depending on the syntax that you prefer)

$hash = New-Object system.collections.hashtable$hash.a = "Entry for a"$hash.A = "S.th.else for A"$hash.0 = "Entry for 0"$hash.1 = "Entry for 1"$hash.KEY$hash


You can create a case-sensitive powerhsell hash table using System.Collections.Hashtable

$x = New-Object System.Collections.Hashtable $x['a']="Entry for a"$x['A']="S.th.else for A"