Exercise 2: ValueFromPipeline vs. ValueFromPipelineByPropertyName — Possible Solution ==================================================================== THE DIFFERENCE ------------------------------ Per this chapter, ValueFromPipeline binds the ENTIRE incoming piped object directly to the parameter - used when the whole object IS the value you want (like a plain string). ValueFromPipelineByPropertyName instead binds by matching a PROPERTY NAME on the incoming object to the parameter's own name - used when you're receiving a richer object and only want to pull one specific matching property off of it. WHY ValueFromPipeline WOULDN'T WORK FOR Get-Process | Test-ByProperty ------------------------------ Get-Process produces real process objects (System.Diagnostics.Process instances), not plain strings. If $ProcessName had instead been marked ValueFromPipeline, PowerShell would try to bind the ENTIRE process object directly to a parameter typed as [string] - and a process object isn't a string, so this binding would fail (or, at best, produce something meaningless like the object's default string representation) rather than correctly extracting just its ProcessName property. ValueFromPipelineByPropertyName works correctly here specifically because it looks for a property named "ProcessName" on the incoming object and binds just that property's value - which process objects genuinely have - to the identically-named $ProcessName parameter. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains both binding mechanisms, and correctly explains why ValueFromPipeline would fail against Get-Process's own rich objects (a type mismatch between the whole object and a [string] parameter) while ValueFromPipelineByPropertyName succeeds by matching the ProcessName property specifically.