You can write your script method as a separate function first (for example, you did with wellDocumented ), and then pass the function as a script block:
$myClass | add-member -memType ScriptMethod -Name "Foo" -Value ${function:wellDocumented}
You still cannot call Get-Help $myClass.Foo , but you can call Get-Help wellDocumented .
During testing, I could not get help using the method.
briantist
source share