Goal: Download a CSV containing the fields on an item using SPE, including columns for name and type.

Issue: When I try the code below, I get a separate file for each field, rather than a single CSV.

$item = Get-Item -path master: -id <some ID>
$fields = $item.Fields
$fields | select -property name, type | ConvertTo-CSV | Out-Download 

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.