How to execute parallel/ Threaded jobs in PowerShell
![Image](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOSlqZM2i8L0p3b4GysVfH9o2D0irCF2sC5UBnl2MmU02TRF5IlSTqXacgAy0CPRdoIUXyaKxJLZtWxO9UZ76YFG46QjwdHTch7o527dBk8RLYwCC4p6SQZL2CXR_61C5tZcx133tqfwRb/w400-h235/Parallel+Jobs.png)
Many times we need to work in parallel when executing the Powershell commands. Today in this post I will tell how we can execute the commands in parallel. In my case, I have used these parallel jobs for the migration of SharePoint On-Prem to SharePoint Online using Sharegate, executing multiple instances and then monitoring those instances to initiate as soon as any of the instances is finished executing. Step 1: Installing the Module To leverage the benefit of the parallel jobs, we need to install the Module so to install the module, execute the following command Install-Module - Name " ThreadJob " - Scope AllUsers Once the module is installed, then you are ready to go. Step 2: Execute Parallel Jobs Now you can start parallel jobs in the background. Here is the sample for executing the parallel jobs $Job = Start-ThreadJob - FilePath " .\PowershellScript.ps1 " - ArgumentList @ ($param1, $param2) - Name