Recent improvements with handling of Group and Inactive mailboxes for ExO PowerShell cmdlets

While Office 365 change management is slowly getting better in terms of notifying the customers about any new or improved features, it’s not uncommon for some minor changes to still go under the radar. In this article, we will go over few such recent improvements, which will certainly make the life of any Exchange Online administrators easier. Well, at least the administrators that prefer using PowerShell ūüôā

The first such improvement is the fact that the Get-Recipient cmdlet finally returns Office 365 Group mailbox objects by default. Those of you that have followed the evolution of Office 365 Groups might recall that Microsoft changed the underlying group management cmdlets several times, with the currently used ones being *-UnifiedGroup. Because of this journey or simply by oversight, the otherwise very useful Get-Recipient cmdlet did not include any Office 365 Group objects in its default output and you had to explicitly specify the recipient type, for example via:

Get-Recipient -RecipientTypeDetails GroupMailbox

The problem with this approach was that only Group mailbox objects were returned, which meant that if you want to fetch all unique recipients, you had to run another instance of the Get-Recipient cmdlet or use a long list of values for the RecipientTypeDetails parameter instead:

Get-Recipient -RecipientTypeDetails @('UserMailbox','SharedMailbox','RoomMailbox','EquipmentMailbox','TeamMailbox','DiscoveryMailbox','MailUser','MailContact', 'DynamicDistributionGroup', 'MailUniversalDistributionGroup', 'MailUniversalSecurityGroup', 'RoomList','GuestMailUser','PublicFolder','GroupMailbox')

Well, after three years, we can now finally use the following simple format to get all valid recipient types (sans some “hidden” ones):


The next improvement is with the Get-MailboxStatistics cmdlet, which is often used to report on the size or number of items in a mailbox. Granted, better methods exist nowadays thanks to the Office 365 reports, but many organizations still use scripts based on this cmdlet. Up until recently, the cmdlet only worked against “active” mailboxes, meaning there was no way to get those statistics on any soft-deleted or inactive mailbox. Now, you can use the –IncludeSoftDeletedRecipients switch to include any such mailbox. Here’s an example:

Get-MailboxStatistics inactive -IncludeSoftDeletedRecipients

DisplayName               ItemCount
-----------               ---------
Inactive                  1589

Or if you want to get the stats for all inactive mailboxes:

Get-Mailbox -InactiveMailboxOnly | Get-MailboxStatistics -IncludeSoftDeletedRecipients

And yes, the cmdlet also works against Office 365 Group objects now! For example:

Get-UnifiedGroup TeamSite | Get-MailboxStatistics

DisplayName               ItemCount
-----------               ---------
TeamSite                  416

Moving on, another recent improvement worth mentioning are the cmdlets to recover deleted messages from a mailbox, including mailboxes used by Office 365 Groups and Teams. This is done via the Get-RecoverableItem/Restore-RecoverableItem cmdlets, and while the cmdlets have been available for half an year now, it isn’t until recently that I notice you can run them against Group/Team mailboxes. You can find detailed guidance on the cmdlets here:

Lastly, there is unfortunately a known issue with the help system in Exchange Online at the moment. Namely, running any help cmdlet results in an error message like the following:

Get-Help Get-Mailbox
Get-Help : Exception calling "Invoke" with "0" argument(s): "Cannot find path '' because it does not exist."
At line:1 char:1
+ Get-Help Get-Mailbox
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-Help], MethodInvocationException
+ FullyQualifiedErrorId : CmdletInvocationException

The Exchange team is aware of this issue and a fix is already rolling out, so this issue should disappear in a week or two.

4 thoughts on “Recent improvements with handling of Group and Inactive mailboxes for ExO PowerShell cmdlets

  1. kids-unite says:

    10 September 2019 – error, get-help : Exception calling “Invoke” with “0” argument(s): “Cannot find path ” because it does not exist.” is still existing

  2. omar says:

    I am still getting the error with get-help. Do you know if your tenant still has that issue?

    1. Vasil Michev says:

      It does, and it doesn’t look like this is going to get fixed… On the bright side, using the ExO MFA module works fine with Get-Help.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.