Using the Parameter attribute to set either ValueFromPipeline or ValueFromPipelineByPropertyName sets a parameter up to fill from the input pipeline.
Pipeline input
About ValueFromPipeline
ValueFromPipeline allows the entire object to be passed into a parameter from an input pipeline. The following function implements an InputObject parameter, which accepts pipeline input by using the ValueFromPipeline property of the Parameter attribute:
function Get-InputObject {
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline)]
$InputObject
)
process {
'Input object was of type {0}' -f $InputObject.GetType().FullName
}
}
Remember that values read from an input pipeline are only...