Skip to main content

Posts

Showing posts from March, 2022

Parallel Processing example using PowerShell

PowerShell version 7 has option to run tasks in Parallel.  This would mean that task that can be run in Parallel mode and tasks can be done simultaneously and save time.  How to get started or making use of Parallel in PowerShell?  First, PowerShell has to be in version 7.  Version 7 of PowerShell can be downloaded from Microsoft via this link below.  PowerShell 7 download. Choose the version, whether its x86 or x64.  The CPU architecture in your system will determine whether x64 PowerShell can be used or not.  Check out this link to check CPU architecture in your system:  Check if 64 bit processor or 32 bit Sample code below, shows how Parallel processing in PowerShell can be done.    $HostsIPs = '127.0.0.1','8.8.8.8','8.8.4.4','1.1.1.1'    $HostsIPs | ForEach-Object -Parallel {      Test-Connection $_      } -ThrottleLimit 5   The screenshot image below, shows that the commands indeed were processed in a Parallel mode since it was executed simultane