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\"] =
As mentioned in a previous answer, clone is the way to go. I had a need to replace any null values in a hash with "Unknown" nd this one-liner does the job.
clone
($record.Clone()).keys | %{if ($record.$_ -eq $null) {$record.$_ = "Unknown"}}