function test([string]$word){
return $word
}
Get-ADUser -Identity Function:\test("bill")
From what I can tell the above should work. MS has an example below where it looks like they call a function as a parameter. But its not working for me.
MS example.
Get-ChildItem -Path Function:\Get-*Version | Remove-Item
Link - https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/09-functions?view=powershell-7.1
foo arg1 arg2- not like C# methods -foo('arg1', 'arg2'). If you use,to separate arguments, you'll construct an array that a command sees as a single argument. To prevent accidental use of method syntax, useSet-StrictMode -Version 2or higher, but note its other effects. See this answer for more information.