Many thanks for the solution you suggested.
I'll try as soon as possible.
However, my problem is a little bit more complex, and my code should look like the following (fictional) sample:
$Result = Invoke-Command -ComputerName myComputer -ScriptBlock {
...
...
if ($a > $b)
{
$result = 1
}
...
...
...
if ($c > $d)
{
$result = 2
}
...
...
}
$Result
How can I make the scriptblok return 1 or 2 ot anything else based on the contents of the scriptblock?
Regards
Marius