Photo by KML on


Microsoft recently announced Exchange Online v2 powershell. It has new type of cmdlets starting with Get-EXO* and one of the example cmdlet is GET-EXOMailbox. These new type of cmdlets help to extract large number of objects much faster than old cmdlets.

At this point, It doesn’t have all exchange cmdlets using new method but we can hope in future that all type of cmdlets will be supported. I tried GET-EXOMailbox myself for 10,000 object and it was able to get detail in less than 2 minutes, which was a surprise.

Installation Steps

Update PowerShellGet

Verify – If PowerShellGet version is less than 2.2.1 then run below command to update PowerShellGet, without that you will get below error during new installation of ExOnlineV2 :

Get-Module -Name PowerShellGet
Install-Module -Name  PowerShellGet -Force

Launch Powershell again, now PowerShellGet version will be 2.2.1 or above.

Get-Module -Name PowerShellGet

Install Exchange Online V2

Run this command in elevated powershell and accept prompts :

Install-Module -Name ExchangeOnlineManagement

As soon as you finish it’s installation, you will get new type of commands.

Connect to Exchange Online Powershell v2

Run these command and pass your credentials when prompted.

$cred = Get-Credential
Connect-ExchangeOnline -Credential $cred -ShowProgress $true

If successful, you will be greeted with below window and now you can run commands :

How to run Get-EXOMailbox command

Check example of Get-EXOMailbox and you will find that Get-EXOMailbox isn’t a true copy of Get-Mailbox, It has some differences and the major are Properties and PropertySets.

-PropertySets accepts these values All, Minimum, AddressList, Archive, Audit, Custom, Delivery, Hold, Moderation, Move, Policy, PublicFolder, Quota, Resource, Retention, SCL, SoftDelete, StatisticsSeedthat you nee

In these 2 examples, you can see that PropertySets are Retention and Minimum and both returned different type of values. It means you can use these different propertysets to extract the necessary information.

You can club multiple PropertySets using comma as well :

Get-ExoMailbox -Identity -PropertySets Retention, Minimum
Get-ExoMailbox -Identity -PropertySets Retention
ExternalDirectoryObjectId     : 8bced835-6b99-4a8c-b035-cf5f1feada25
UseDatabaseRetentionDefaults  : False
RetainDeletedItemsUntilBackup : False
SingleItemRecoveryEnabled     : True
RetentionHoldEnabled          : False
EndDateForRetentionHold       :
StartDateForRetentionHold     :
RetentionComment              :
RetentionUrl                  :
OrphanSoftDeleteTrackingTime  :
RetentionPolicy               : Default MRM Policy
RetainDeletedItemsFor         : 14.00:00:00
PS C:\WINDOWS\system32> Get-ExoMailbox -Identity -PropertySets Minimum

ExternalDirectoryObjectId : 8bced835-6b99-4a8c-b035-cf5f1feada25
UserPrincipalName         :
Alias                     : admin
DisplayName               : Sourabh Jha
EmailAddresses            : {,}
PrimarySmtpAddress        :
RecipientType             : UserMailbox
RecipientTypeDetails      : UserMailbox
Identity                  : SourabhJha
Id                        : SourabhJha
ExchangeVersion           : 0.20 (
Name                      : SourabhJha
DistinguishedName         : CN=SourabhJha,,OU=Microsoft Exchange Hosted Organizations,DC=IND11111PR01A003,DC=PROD,DC=OUTLOOK,DC=COM
OrganizationId            : IND11111PR01A003.PROD.OUTLOOK.COM/Microsoft Exchange Hosted Organizations/ - IND11111PR01A003.PROD.OUTLOOK.COM/ConfigurationUnits/
Guid                      : 0e90b4cc-aa1d-4cb4-8d2d-436219ed249a

Ref :

Thank you for reading and please share your feedback