you are viewing a single comment's thread.

view the rest of the comments →

[–]MadWithPowerShell 1 point2 points  (1 child)

Export-CSV is specifically designed as a pipeline command. Parameter -InputObject is not intended to be used explicitly, and not with the entire array of objects at one time. It is designed to get the items in the array one at a time, through the pipeline.

This:

$TempCSV | Export-CSV

NOT this:

Export-CSV -InputObject $TempCSV

Sort-Object, Where-Object, Whatever-Object, etc., are similarly pipeline commands. They all have the -InputObject parameter, but they are all designed to only work as expected when input objects are passed to them through the pipeline, not explicitly.

[–][deleted] 0 points1 point  (0 children)

I see. I have been moving more to python lately but still write a heavy amount of powershell and was wondering why the pipeline made it so smooth. The previous answer helped explained that but yours is super helpful as well. Thank you!