I'm trying to run two Invoke-Sqlcmd
in parallel and then wait all the results.
$server1 = '...'
$server2 = '...'
workflow work {
parallel {
$r1 = Invoke-Sqlcmd -ServerInstance $server1 'select 1 a'
$r2 = Invoke-Sqlcmd -ServerInstance $server2 'select 2 a'
}
}
work
# do something with $r1 and $r2. How to access the variables here?
- How to pass
$server1
and$server2
to the code block? - How to get
$r1
and$r2
from the parallel block?