Delay-Bind: Is it possible to prevent binding unless a scriptblock is used?

I want to be able to pipe from Function A to Function B, but I only want Function B to bind to properties if the parameter is named or is named and a script block is used when calling the function. The effect would be that only parameters that are explicitly called bind, even if present on the object passed by Function A.

Can you give an example?

Function A-Function {

[PSCustomObject]@{
Param1="ValueA"
Param2="ValueB"
Param3="ValueC"
}

}

Function B-Function {

param(

[Parameter(ValueFromPipelineByPropertyName)]
[string]
$Param1,
[Parameter(ValueFromPipelineByPropertyName)]
[string]
$Param2,
[Parameter(ValueFromPipelineByPropertyName)]
[string]
$Param3

)

$Param1
$Param2
$Param3

}

A-Function | B-Function -Param1 ValueX

Output:

ValueX             
ValueB                                                 
ValueC

Would there be a way to prevent the parameter binding from happening on param2 and param3? It inherently binds, is there a way to prevent it?

I get the error: Missing an argument for parameter ‘Param1’.

Just supply a value to Param1, it will output as indicated. Is there a way to prevent parameter binding is the nature of the question though.

That’s sort of like saying, “how can I ignore the parameters that I’m sending?” Why would you want to? You could use select-object to only send the one property.

B-Function -Param1 ValueA -Param2 ValueB -Param3 Valuec

A-Function | select param1 | B-Function