Pass object[] into a function in PowerShell

$Input is the name of an automatic variable. Use a different name.

I recommend $InputObject as that is in common usage so it has a well-understood meaning, but usually that means you are accepting pipeline input as well.

Of course if there’s a name that’s more descriptive for this parameter, you should use that.

I have submitted this issue on the PowerShell GitHub project suggesting that Set-StrictMode be modified to check for automatic variable assignment.

Leave a Comment