PowerShell-Docs icon indicating copy to clipboard operation
PowerShell-Docs copied to clipboard

Accessing global functions in ForEach Parallel

Open devmanlab opened this issue 6 years ago • 2 comments

Hello, I am processing large amount of Graph calls using powershell script block - 500K in my case. I want to process script blocks in batches. My ForEach-Object loop is defined inside class, say Library, in method, say ExportItems. Library.ExportItems call global function named Log([string]text). Method can successfully use it, however Parallel block cannot. While I will report it to product team, it would be nice to have documentation on how to access not just variables, defined outside parallel block, but also functions.

Thank you!


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

devmanlab avatar Apr 14 '20 17:04 devmanlab

cc: @PaulHigin

sdwheeler avatar Apr 14 '20 19:04 sdwheeler

I'll respond to the equivalent issue created in PowerShell github.

https://github.com/PowerShell/PowerShell/issues/12313

PaulHigin avatar Apr 14 '20 20:04 PaulHigin