Opening multiple sessions in parallel - "PowerShellComponent - Execute Script" Process Component

Hello,

I've created a process that has multiple "PowerShellComponent - Execute Script" process steps where for each step the "StartScriptOrPath" parameter creates a remote session to the same Exchange Online instance.  The "StopScriptOrPath" parameter then removes the session.  Now, this process, when I run for one or two objects simultaneously, finishes just fine.  However, when I start to run it for many objects, say 10, I'll start to encounter the following error for the either the "StartScriptOrPath" or "StopScriptOrPath" parameter.

"ErrorMessages    (2022-02-15 06:56:41.400) Error initializing PowerShell runtime environment: Cannot validate argument on parameter 'Session'. The argument is null. Provide a valid value for the argument, and then try running the command again.
Error running initial script."

Why is it, that when run for multiple objects, the code for establishing a session errors out?  Are the sessions interrupting each other when ran in parallel?  

See screen shots for "StartScriptOrPath" and "StopScriptOrPath" code and process steps. 

StartScriptOrPath code:

StopScriptOrPath code:

Process steps:

  • Found out what the issue was.  It looks like there is a limit on the amount of remote sessions that can be made to Exchange Online at one time (3 sessions is the limit).  That's why when I ran the process for 1 or 2 objects it finished fine and when I did it for 10 objects it errors out (I was creating 10 sessions which exceeds the 3 session limit).  Need modify the process in such a way so that I don't exceed the 3 session limit.