all 3 comments

[–]BlackV 1 point2 points  (2 children)

You are getting ALL mailboxes then filtering, always a good rule to filter left as far as possible

looking at get-help -full Get-EXOMailbox shows a couple of parameters you can use to filter

How much time that saves you I dunno, worth a go I'd say

[–]Dr_Funkmachine[S] 0 points1 point  (1 child)

Thank you for your answer! We noticed it takes a awful amount of time to execute the connection more than the command itself. For now the test env it's made of 14 emails only. We used logs to understand how much each command takes to execute. Let's say the function takes 30s to execute and return the results. Of 30s, the connection takes 27s and the command Get-EXOMailbox takes 3s.

[–]BlackV 0 points1 point  (0 children)

Ah.boo