Just curious – If I want to combine output into a CSV or XML file and Select members that are not of type System.String, How can I do this?

I added a variable $output = @() and concatenate the output of the select statement. But at the end when I channel the pipeline to XML or CSV, the original objects are already disposed of so only the data type is written to the CSV.

Is there a way to pipeline the select statement as only System.String data type?

Or, is it safe not for dispose of all of the objects and let regular garbage collection take care of them or is this a case of lost reference pointer and the obect never being cleaned up?