I've been searching this for quite some time and can't seem to get right syntaxes for something that I believe is very useful.
I want to call local function using Invoke-Command, which includes other locally defined functions.
Here's rough example:
Function foo1{
}
Function foo2{
foo1
}
invoke-command -ComputerName SERVERNAME -Credential WHATERVER -ScriptBlock ${Function:foo2}
I got almost everything working except calling function "foo1" from withing "foo2" isn't working out.
What's the correct way to do that?