PowerShell Tutorials : ForEach-Object -Parallel (Parallelism in PowerShell)

preview_player
Показать описание
In this video I go over how to use the -Parallel parameter which is new to the ForEach-Object cmdlet in PowerShell 7, in the background it uses runspaces which have been around since V2. I will show you where -Parallel is good idea to use and also where it would be a bad idea and cause a longer script run time because of the resources and time needed to spin up these runspaces.

I go over how to use variables from outside the foreach loop as well as functions as using outisde functions and variables can be tricky in the foreach-object -parallel loops.

Tags:
Parallel, programming, coding, scripting, jackedprogrammer, powershell, foreach, parallelism
Рекомендации по теме
Комментарии
Автор

Thank you very much, I have gained advanced new knowledge.

fikretbadakol
Автор

Wow - thanks for such a great tutorial !

AmitSingh-vhsi
Автор

i'm having troubles with having a counter, i define it outside the foreach-object, i import it with $counter = $using:counter but when i do an increment on it, it doesn't actually increment and show as +1, works on the collection tho.

ivanvaselli