0

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?

Amir Katz
  • 1,027
  • 1
  • 10
  • 24

1 Answers1

1

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[]

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206