Open plastikfan opened 4 years ago
Tested with this line:
[scriptblock]$wrapper = [scriptblock]::Create('write-HostItemDecorator')
but powershell still prompts for parameters:
cmdlet write-HostItemDecorator at command pipeline position 1 Supply values for the following parameters:
... so abandon ship for now!
write-HostItemDecorator can easily be turned into a script block obviating the need for the wrapper object. I discovered this as a result of perusing as issue on PSScriptAnalyzer (https://github.com/PowerShell/PSScriptAnalyzer/issues/711#issuecomment-535304534); a comment by @rjmholt illustrates how to do this:
We can use this technique for passing write-HostItemDecorator as a parameter to invoke-ForeachFile, without powershell mistaing it for in an place invocation of the function.