I\'m writing a PowerShell script that will execute commands on a remote host using Invoke-Command and its -ScriptBlock parameter. For example,
-ScriptBlock
I think you want:
function Foo ( $a,$b) { $a $b return "foo" } $x = "abc" $y= 123 Invoke-Command -Credential $c -ComputerName $fqdn -ScriptBlock ${function:Foo} -ArgumentList $x,$y