ForEach-Object -Parallel

say it: “for-EECH OB-jekt PAIR-uh-lel” /fɔrˈitʃ ˈɒbdʒɛkt ˈpɛrəˌlɛl/

Runs the loop body for several items at the same time.

What is ForEach-Object -Parallel?

ForEach-Object -Parallel (PowerShell 7) runs the script block for several items at the same time, which speeds up slow work like network calls.

'site1.com', 'site2.com', 'site3.com' | ForEach-Object -Parallel {
    Test-Connection $_ -Count 1
} -ThrottleLimit 3

Level: Freelancer · More PowerShell terms at this level

Updated