How do I manage Office 365 mailboxes with PowerShell?

Follow the steps below to set up the computer so that you can manage Office 365 mailboxes with PowerShell. The computer does not have to be joined.

On every log in after, connect to Office 365 Exchange using the script and enter in your credentials:

  1. Connect
    PowerShell does NOT have to be run as an admin
  2. Enter in your OU Admin credentials in the form of UPN and password

Initial Setup

  1. Download and Install Microsoft Online Services Sign-in Assistant for IT Professionals RTW from
  2. Visit and save the script
  3. Run PowerShell as an admin or else you cannot install modules
  4. Install Windows Azure Active Directory Module for Windows PowerShell
    Install-Module -Name MSOnline
  5. If necessary, allow PowerShell to install and import the NuGet provider
  6. If necessary, trust the repository and install the modules
  7. Enable running scripts
    Set-ExecutionPolicy -ExecutionPolicy Unrestricted
  8. Allow changes to the execution policy
  9. Browse to the saved script from and run it
  10. Enter in your OU Admin credentials in the form of UPN and password
  11. Wait for it to finish.
  12. Test a command
    Get-oMailbox -Identity
  13. Verbage for Office 365 mailboxes cmdlets
    All cmdlets use the format of Verb-Noun. The format for these cmdlets is essentially the same as they are for on-premise mailboxes, with one difference: you need to place the letter "o" in front of the noun part of each cmdlet. For example:
    • Get-Mailbox -Identity [UPN] will look for a mailbox on-premise.
    • Get-oMailbox -Identity [UPN] will look for a mailbox in Office 365.
  14. Extra: If all goes well with the initial setup, it should look like:


Article is closed for comments.
Powered by Zendesk