Search notes:

Powershell: Param(Parameter(ValueFromPipeline=…)

A parameter that has its valueFromPipeline attribute set to $true gets its values from the pipeline (if the command is executed within a pipeline).
A function that has such a valueFromPipeline parameter needs to have a process block to process the individual objects from the pipeline.
set-strictMode -version 3

function show-piped-objects {

   param (
      [parameter (valueFromPipeline=$true )] [string] $parameterFromPipeline,
                                             [string] $ordinaryParameter
   )


   process {
      write-host "ordinaryParameter: $ordinaryParameter, parameterFromPipeline = $parameterFromPipeline"
   }

}

'foo', 'bar', 'baz' | show-piped-objects -ordinaryParameter XXX
Github repository about-PowerShell, path: /language/statement/function/parameters/attributes/parameter/valueFromPipeline/show-piped-objects.ps1

TODO

This stackoverflow answer indicates that parameters with valueFromPipeline=$true should not also have a position attribute.

Index