Looping over a hash table
suggest change$hashTable = @{
Key1 = 'Value1'
Key2 = 'Value2'
}
foreach($key in $hashTable.Keys)
{
$value = $hashTable.$key
Write-Output "$key : $value"
}
# Output order of .Keys is not guaranteed.
# Key1 : Value1
# Key2 : Value2
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents