February 2019
Intermediate to advanced
626 pages
15h 51m
English
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 available in the process block of a script or function. As the default type assigned to a parameter is Object, this will accept any kind of input that might be passed. This behaves in a similar manner to the InputObject parameter ...
Read now
Unlock full access