Given the following Script, how can I return two variables to the main code?
I have tried the return command but show an error. Please find the code and error message below.
Code:
workflow Test-MultiReturnVals
{
parallel
{
$a = @(Test-Connection 8.8.8.8 -count 3)
$b = @(Test-Connection 4.2.2.1 -count 3)
return $a, $b
}
}
$c, $d = Test-MultiReturnVals
$c
Error:
Microsoft.PowerShell.Utility\Write-Error : The workflow was terminated by a Terminate activity. At RunScripts:9 char:9 + + CategoryInfo : NotSpecified: (:) [Write-Error], WorkflowReturnException + FullyQualifiedErrorId : Microsoft.PowerShell.Workflow.WorkflowReturnException,Microsoft.PowerShell.Commands.WriteErrorCommand + PSComputerName : [localhost]