i want to use a predefined function on a remote server with ps invoke and i need to send an object as parameter. This code always writes objects first element.
$object = @('a','b','c')
function testA {
[CmdletBinding()]
param (
[Parameter()]
[System.Object]
$test
)
write-host $test
}
Invoke-Command -Session $session -ScriptBlock ${function:testA} -ArgumentList $object
Is there a way to pass function and object to the remote server with Invoke-Command?
Thx.