/Invoke-Parallel

Speed up PowerShell with simplified multithreading

Primary LanguagePowerShellMIT LicenseMIT

Build status

Invoke-Parallel

This function will take in a script or scriptblock, and run it against specified objects(s) in parallel. It uses runspaces, as there are many situations where jobs or PSRemoting are not appropriate.

Instructions

#Download and unblock the file(s).
#Dot source the file.
    . "\\Path\To\Invoke-Parallel.ps1"

#Get help for the function
    Get-Help Invoke-Parallel -Full

#Use Invoke-Parallel with variables in your session
    $Number = 2
    1..10 | Invoke-Parallel -ImportVariables -ScriptBlock { $Number * $_ }

Some outdated notes and details are available on the TechNet Galleries submission.

Help!

Would love contributors, suggestions, feedback, and other help! Split this out at the suggestion of @vors to help enable collaboration.

Notes