I am trying to write a script that will accept input from the pipeline. I have found that if I pass multiple objects through the pipeline, only the last object is passed into the script.
[cmdletBinding()] param ( [Parameter(Mandatory=$True,ValueFromPipeline=$True)] $variable ) $variable
I save this as script.ps1, then run
get-process | .\script.ps1
The $variable contains only the last process in the list of processes, rather than the full list of processes that I was expecting.
Can anyone help me with why this happens?