String interpolation of hashtable values in PowerShell

powershell

Solution

Write-Host "Hello, $($hash.First) $($hash.Last)."

Problem

I've got a hashtable: ``` $hash = @{ First = 'Al'; Last = 'Bundy' } ``` I know that I can do this: ``` Write-Host "Computer name is ${env:COMPUTERNAME}" ``` So I was hoping to do this: ``` Write-Host "Hello, ${hash.First} ${hash.Last}." ``` ...but I get this: ``` Hello, . ``` How do I reference hash table members in string interpolation?

Original source