ValueFromPipeline
noun
say it: “VAL-yoo frum PYPE-lyne” /ˈvælju frəm ˈpaɪplaɪn/
A setting on a PowerShell parameter that makes it receive each object piped into the function.
What does ValueFromPipeline do?
ValueFromPipeline marks the parameter that catches what's piped in. Each object that arrives is put in that parameter, one at a time, and the function's process block runs for it.
function Limit-Playlist {
[CmdletBinding()]
param([Parameter(Mandatory, ValueFromPipeline)] $Song)
process { $Song.Title }
}
Get-Song -Mood Chill | Limit-Playlist
In a sentence
- “The $Song parameter has ValueFromPipeline, so each song lands in it.”
- “With ValueFromPipeline, Get-Song | Limit-Playlist worked.”
Level: Freelancer · More PowerShell terms at this level
Updated