-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Hi CrowdStrike,
Cool script, but poor performance with big Office365 environments. Say, the following commands are specified: SMTPForward, FullAccessGranted, AnyAccessGranted, SendAsGranted together. This means script will run
Get-EXOMailbox -ResultSize Unlimited -ErrorAction SilentlyContinue | Get-EXORecipientPermission -ErrorAction Stop 4 times. This works well with small number of mailboxes, but a single execution of this command on, say, 50000 mailboxes will take a few days (believe me) to complete (eventually Microsoft will throttle you and slow down the requests). Your script calls it 4 times which will easily take more than a week (not counting possible auth session expiration when you'll need to restart the script).
My proposal would be first to save mailboxes to a variable like $mailboxes = Get-EXOMailbox -ResultSize Unlimited -ErrorAction SilentlyContinue and same for $permissions = $mailboxes | Get-EXORecipientPermission -ErrorAction Stop and reuse both $mailboxes and $permissions where possible. Let me know if I can contribute to the project!