Why Use The ExchangeOnlineManagement Module


Microsoft recently announced a new PowerShell module written by the Exchange team for management of Exchange Online. This is the first time that the Exchange team has published their module on the PowerShell Gallery. For the purpose of this article I will be using Get-Mailbox as the main focus.

Changes to my workflow

Due to my job as an Office 365 Technical Architect I find myself connecting to Exchange Online PowerShell regularly, previously this was done with 3 or 4 lines of code, which I made into a function with the name Connect-ExchangeOnline - it looked like this.

function Connect-ExchangeOnline {
    param (
    $exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $office365Credential -Authentication "Basic" -AllowRedirection
    Import-PSSession $exchangeSession -DisableNameChecking

This was both a positive and a negative thing as the new module also uses the cmdlet Connect-ExchangeOnline for the initial connection. The biggest benefit of the new module is that instead of needing to download a module from the Exchange Control Panel for MFA this is all baked into the new module, this was not something that my profile originally allowed for so this was immediately an improvement for me.


There are some major differences to get used to with the new module, they are mainly new cmdlets that are faster than the old ones. These are mentioned when you run the connect cmdlet, the old cmdlets are also available once you have connected.

New commands

Fortunately backwards compatibility is retained and so scripts using Get-Mailbox (and other updated commands) will still work. When calling the new command Get-EXOMailbox we find that it outputs less properties by default. The default output properties are:

  • ExternalDirectoryObjectId
  • UserPrincipalName
  • Alias
  • DisplayName
  • EmailAddresses
  • PrimarySmtpAddress
  • RecipientType
  • RecipientTypeDetails
  • Identity
  • Id
  • Exchange Version
  • Name
  • DistinguishedName
  • OrganizationId
  • Guid

If you need more than this then you can use the Properties argument or the PropertySets argument and specify what extra properties/sets you would like. Another major change is that the Identity parameter is required when looking for an individual mailbox, much like other modules for managing an Office 365 environment. This can be majorly frustrating especially if you are used to not needing it, however you get used to it the more you use it.

Due to being a REST based command the initial query of a set of objects can have a slight delay, this is due to several factors and is not particularly noticed over a large dataset but can be very obvious over small datasets. This is caused mainly by paging of the data and RBAC evaluation.


Not all the changes in the new module are good, however in my opinion the good hugely outweighs the bad. My recommendation if you haven’t tried it is to install it following these instructions and give it a go. As the team expand upon the commands using the REST api this will get more powerful, and eventually the Exchange Team will enable access to the API through Graph.

Make sure you send any feedback on the module to exocmdletpreview@service.microsoft.com so that it can improved and grown upon.