Format a nested hashtable
inspired by donothingsuccessfully, what about
$items | ConvertTo-Json
Looks more readable (to me)
You need to expand nested hashtables yourself:
$items | Format-Table Name, @{n='Value';e={ if ($_.Value -is [Hashtable]) { $ht = $_.Value $a = $ht.keys | sort | % { '{0}={1}' -f $_, $ht[$_] } '{{{0}}}' -f ($a -join ', ') } else { $_.Value }}}
It's not pretty but ConvertTo-Xml -As String
can display nested data structures to an arbitrary depth:
$items | ConvertTo-Xml -As String