I try to write a Powershell script that accepts directories from the pipeline as named parameter. My parameter declaration looks like
param([Parameter(Mandatory=$true, ValueFromPipeline=$true, ValueFromPipelinebyPropertyName=$true)] [System.IO.DirectoryInfo[]] $PsPath)
My problem is that the call
gci c:\ -Directory | MyScript
results in only the last element of the result of gci being in the input array. What is wrong here?
Thanks in advance, Christoph