Amir Katz
Amir Katz

Reputation: 1037

Collection<PSObject> to CSV output

Is there a nice way to convert Collection<PSObject> to CSV output?

Collection<PSObject> psResult = pipeline.Invoke();

Tried pipeline.ToCsv(); Also psResult.ToCsv()

Any ideas?

Upvotes: 0

Views: 904

Answers (1)

Mathias R. Jessen
Mathias R. Jessen

Reputation: 174760

Add the ConvertTo-Csv cmdlet to your pipeline.

The Collection<PSObject> returned will consist of comma-separated strings, easily converted to IEnumerable<string> or string[]

Upvotes: 1

Related Questions