I\'m trying to loop through a hash table and set the value of each key to 5 and PowerShell gives an error:
$myHash = @{} $myHash[\"a\"] = 1 $myHash[\"b\"] =
You do not need to clone the whole hashtable for this example. Just enumerating the key collection by forcing it to an array @(...) is enough:
@(...)
foreach($key in @($myHash.keys)) {...