Hallo,
i have a problem with the new PowerShell7 Feature "ForEach-Object -parallel !!!!
I tryed a lot of thinks, but nothing workted for me, I hope you can help.
I try this code:
1 .. 5 | ForEach-Object -Parallel { "Hello $_"; sleep 2; } -ThrottleLimit 5
$textbox1.Text = "Fertig"
In PowerShellStudio 2021 i select V7 - 64 Bit and hit run. Everythink good, no Problem.
So I hit "Package" and "Build". (In settings i choose Powershell 7.1.0 and Windows Forms)
Than I hit the EXE File. The Programm Starts, but I never come to the point of "$textbox1.text".
In the Taskmanager I can see that 5 new Processes are started called "Windows Powershell", but nothink happen.
So my script and the processes run forever.
I hope someone can help me.
ForEach-Object -parallel
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- SchuleDigital_HG
- Posts: 5
- Last visit: Tue Nov 28, 2023 6:48 am
Re: ForEach-Object -parallel
Thank you.
But this don´t work for me.
I switchted off the STA Mode in Powershell Studio and in the Packager. The script I posted is in an event of an button.
But this don´t work for me.
I switchted off the STA Mode in Powershell Studio and in the Packager. The script I posted is in an event of an button.
Re: ForEach-Object -parallel
Since it works in a script but not when packaged I suspect there is a mismatch to the packaging engine. You might want to ask the question in the PSS product support forum.
-
- Posts: 1
- Last visit: Wed Apr 21, 2021 12:06 am