Working with the PowerShell pipeline
suggest changeIntroduction
PowerShell sends whole objects down the pipeline to the next command, or to the host when nothing consumes them. Unlike a text pipeline, the data is not parsed from columns. A command can take pipeline input, and any objects it writes go to the pipeline.
Syntax
beginruns once, before any pipeline input. AValueFromPipelineparameter is unset here.processruns once per pipeline object. The parameter is the current object.endruns once, after the last object. The parameter still holds that last object.
Remarks
The pipeline delivers one object at a time. It does not pass the whole array into process unless the command is written to collect it.
continue inside process does not mean "next object." It can leave the function and skip end. Use return to finish the current process invocation and move to the next object.
$OutputEncoding is the encoding PowerShell uses when it passes text to a native program. Set it to [Console]::OutputEncoding when that program expects the console encoding.
More on $OutputEncoding: https://devblogs.microsoft.com/powershell/outputencoding-to-the-rescue/