Thank you, Peter, for your suggestion!
Unlike Basic authentication, the Connect command is much more secure, and its output cannot be saved into a variable. Additionally, you might notice that we aren't clearing the $conn variable in the script. This means the script won't check every time and will only connect to EXO at the beginning of the script. However, this approach might not work if the EXO connection breaks midway due to any issue or if the PIM role expires and EXO admin access is lost. This can be easily managed by adding the -ErrorAction Stop switch. But we can leave this for the admin to decide and use if needed.
Furthermore, even if the variable is cleared and rebuilt every time, we haven't seen any significant delay in testing this approach with the Get-Mailbox cmdlet. However, it also depends on the network, the mailbox location, and other factors.
Also, we have used Get-ConnectionInformation and tried to test, but it doesn't support and work as intended. Anything else is making things complicated and the goal here is to get the bulk operation done faster. So, to achieve the goal and keep it simple, we finalized on the Get-Mailbox cmdlet.
Lastly, the purpose of this blog post was to introduce the idea of parallelism and provide an example for the use. The script shared is just an example and by all means, you can make changes and improvements to the example as fits you best!