Converting hashtable to array of strings

powershell

Solution

[string[]]$l_array = $l_table | out-string -stream

Problem

How can I convert a hashtable to an array of strings? Suppose $l_table is a hashtable. If I try ``` $l_array = $l_table | format-table ``` then $l_array is an array, but an array of "FormatEntryData" objects. If I do ``` [string[]]$l_array = $l_table | format-table ``` then $l_array is an array of strings, but the strings are all "Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData". If I try ``` $l_array = $l_table | out-string ``` then $l_array is a single string. I've tried lots of other things, but nothing works, short of manually looping through, which I really don't want to do.

Original source

Related problems