Issue is that Out-Download does not support object[]
, so we need to cast to string[]
:
[string[]]$output = $fields | select -property name, type | ConvertTo-Csv
Out-Download -InputObject $output -Name Fields.csv
This produces a single download file. You can confirm that $output is the right type with
PS master:\>$output.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String[] System.Array
You can also do this in a single line with this:
Out-Download -inputobject ([string[]]( $fields | select -property name, type | ConvertTo-Csv)) -name Fields.csv
but this will not work:
Out-Download -inputobject ([string[]]( $fields | select -property name, type | ConvertTo-Csv)) -name Fields.csv
as the piping syntax causes Out-Download to get called separately for each row.