Need suggestion on a faster way to determine if Mailbox has delegates using (ExchangeOnline) EXO V2

Animesh Anand 81 Reputation points
2020-10-16T01:57:23.87+00:00

For our solution we need to determine if a mailbox has delegates. For this we had been using Get-Mailbox cmdlet and then we use ExchangeSecurityDescriptor property to get the DiscretionaryAcl and then the DiscretionaryAcl.Get_Count() method to determine how many delegates does the mailbox have.

As per suggestions in from @Vasil Michev determining-if-shared-mailbox-has-delegates-using.html, we tried to solve this using implicit remoting. However, the issue we are facing with that is this will not let us use the EXO cmdlets as mentioned by @Vasil Michev in the post above, so we'll not be able to leverage the newer cmdlets.

Alternative way we are solving this is that we first call the Get-Mailbox, keeps the results for other use, then we pipe the Id's to Get-EXOMailboxPermissions to get results for the permissions.
However, earlier(using V1) when we were doing this for a tenant with 40K mailboxes, we were getting this information in about 4 minutes with a single cmdlet call.
Now we either need the additional call for Get-EXOMailboxPermissions(which is taking an additional 30-40 mins to complete) or we need to use the implicit remoting, which does not let us using the EXO cmdlets.
I was wondering if there was a way to get this information faster(some other property etc.) and also without needing to use the older cmdlets.

Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,197 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,360 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vasil Michev 95,671 Reputation points MVP
    2020-10-16T06:03:12.157+00:00

    Um, nothing is stopping you from using the "old" cmdlets. In fact, the V2 module features both the "old" cmdlets (Get-Mailbox, which you can also query via implicit remoting) and the "new" REST-based ones (Get-ExOMailbox). You can mix and match those where needed, even pipe output between them in some cases.

    Just to be clear, you dont need to create a new session in order to use implicit remoting, all you need to do is get the existing PSSessionId and pass the scriptblock to it. Thus, once you connect via the V2 module, you can still leverage this method just fine.

    And yes, this will be much faster than anything else currently available, even the V2 cmdlets.


0 additional answers

Sort by: Most helpful