I added Invoke-Parallel.ps1 to my module and dot source it as Invoke-Parallel
However, I am struggling with some scoping issues it seems. If I make functions/cmdlets in another module that uses Invoke-Parallel and want to use bound parameters, they will not be available in the scriptblock.
Will only work if the function foo is a cmdlet/function in the same module as Invoke-Parallel. Also, $Using:bar will not yield anything.
Is there any chance that
1) it can be made to work cross-modules?
2) $using:variable can work inside functions?
I know this works in PoshRSJob, but the job i'm running seems to struggle after more than 10 elements with it for some reason, throwing all kinds of errors.
I added Invoke-Parallel.ps1 to my module and dot source it as Invoke-Parallel
However, I am struggling with some scoping issues it seems. If I make functions/cmdlets in another module that uses Invoke-Parallel and want to use bound parameters, they will not be available in the scriptblock.
Function foo { [cmdletbinding()] param($bar)
$foo = "test"
0 | Invoke-Parallel -ScriptBlock { write-host $bar } -ImportVariables -Verbose }
$a = "test" Foo -bar $a
Will only work if the function foo is a cmdlet/function in the same module as Invoke-Parallel. Also, $Using:bar will not yield anything.
Is there any chance that
1) it can be made to work cross-modules? 2) $using:variable can work inside functions?
I know this works in PoshRSJob, but the job i'm running seems to struggle after more than 10 elements with it for some reason, throwing all kinds of errors.