The answer to the other part of your question is that {...}
after the ?
or Where
does indeed represent a scriptblock. If you look at the help on Where-Object you see this:
-FilterScript <ScriptBlock>
Specifies the script block that is used to filter the objects. Enclose the script block in braces ( {} ).
The parameter name (-FilterScript) is optional.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
The FilterScript
parameter expects a scriptblock. It is positional so you don't have to specify Where -FilterScript { ... }
. It is not pipeline bound but the InputObject
parameter is pipeline bound. That object gets injected into the scriptblock you provide as $_
.