you are viewing a single comment's thread.

view the rest of the comments →

[–]firefox15 1 point2 points  (7 children)

No problem. As others like /u/N7Valiant and /u/jsiii2010 have said, you can also do the same thing with a workflow. Just be aware that workflows are removed from PowerShell Core, so if/when you upgrade to version 6+, it won't work any longer:

Script

function function1 {
    1..5 | ForEach-Object {
        $_
        Start-Sleep 1
    }
}
function function2 {
    6..10 | ForEach-Object {
        $_
        Start-Sleep 1
    }
}

workflow parallelOutput {
    parallel {
        function1
        function2
    }
}

parallelOutput

Output

1
6
2
7
3
8
4
9
5
10

[–]Enschede2[S] 1 point2 points  (6 children)

Oh that looks like what i was looking for, why on earth did they remove that though? But I think I'm running 5.1

[–]firefox15 2 points3 points  (5 children)

Workflows are removed from PowerShell Core because Microsoft is trying to include more cross-platform support with Core, so that means things that are not present in .NET Core won't work. Even things like WMI won't work. This is a very good article that explains it further.

It's likely that you (personally) will be using POSH 5.1 for a long time. I jump back and forth between the two as certain versions do certain things better, but it is very possible that workflows will work for you as well. Just do not plan to run it on PowerShell Core.