February 2019
Intermediate to advanced
626 pages
15h 51m
English
ValueFromPipelineByPropertyName attempts to fill a parameter from the property of an object in the input pipeline. When filling a value by property name, the name and type of the property is important, but not the object that implements the property.
For example, a function might be created to accept a string value from a Name property:
function Get-Name { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipelineByPropertyName)] [String]$Name ) process { $Name }}
Any command that returns an object which contains a Name property in a string is acceptable input for this function. Additional parameters might be defined, which would further restrict the input object type, assuming the new properties ...
Read now
Unlock full access