Exchange Online PowerShell
The ExchangeOnlineManagement module: mailboxes, permissions, transport and mail flow in Microsoft 365.
Official documentation- Connect-ExchangeOnline: AADSTS53003: Access has been blocked by Conditional Access policiesEntra ID refused a token to Exchange Online PowerShell because a Conditional Access policy blocks the sign-in. Find that policy in the Entra sign-in logs.
- Connecting to remote server outlook.office365.com failed with the following error message : Access is deniedNew-PSSession scripts with Basic auth no longer work: remote PowerShell was retired. Install ExchangeOnlineManagement and use Connect-ExchangeOnline now.
- The term 'Get-Mailbox' is not recognized as the name of a cmdlet (Exchange Online PowerShell)In the EXO V3 module, Get-Mailbox and Set-Mailbox exist only after Connect-ExchangeOnline. Connect first; if it still fails, your RBAC roles lack the cmdlet.
- You must call Connect-ExchangeOnline before calling any other cmdlet.Get-EXOMailbox and the other Get-EXO cmdlets fail with this message when no Exchange Online session exists. Run Connect-ExchangeOnline first, then retry.
- The operation couldn't be performed because object 'user@contoso.com' couldn't be found on (Exchange Online)Exchange Online cannot resolve the -Identity value: a typo, a user without a mailbox, a recipient not yet synced, or the wrong cmdlet for the recipient type.
- The proxy address "SMTP:user@contoso.com" is already being used by the proxy addresses or LegacyExchangeDNAnother Exchange Online recipient already holds that email address. Find it with Get-EXORecipient filtered on EmailAddresses, remove it there and retry.
- Connect-ExchangeOnline -AppId -CertificateThumbprint -Organization (app-only, unattended scripts)Connect to Exchange Online PowerShell without a user: register an app with Exchange.ManageAsApp, add a certificate, assign a role, pass AppId and thumbprint.
- Convert a user mailbox to a shared mailbox: Set-Mailbox -Type SharedSet-Mailbox -Identity user@contoso.com -Type Shared converts a mailbox and keeps all mail. Then remove the license if under 50 GB and block the sign-in.
- Get-MessageTraceV2: message trace in Exchange Online PowerShellGet-MessageTraceV2 searches 90 days of mail, 10 days per query, up to 5000 results. Filter by sender, recipient or status; page with StartingRecipientAddress.
- Exchange Online: grant FullAccess, SendAs and SendOnBehalf permissions with PowerShellFullAccess uses Add-MailboxPermission, Send As uses Add-RecipientPermission, Send on Behalf uses Set-Mailbox -GrantSendOnBehalfTo. Add, check, remove each.
- Set-MailboxAutoReplyConfiguration: set an out-of-office reply for another mailboxSet an automatic reply with Set-MailboxAutoReplyConfiguration -AutoReplyState Enabled or Scheduled, internal and external messages and -ExternalAudience.
- Connect-ExchangeOnline -Device (device code sign-in, PowerShell 7 only)Connect-ExchangeOnline -Device prints a code to enter at microsoft.com/devicelogin from any browser. It exists only in PowerShell 7, not in Windows PowerShell.
- Connect-ExchangeOnline -ShowBanner:$false: hide the connection bannerConnect-ExchangeOnline -ShowBanner:$false hides the banner. ShowBanner is a switch: with a space, $false binds to -ConnectionUri instead. Checked in 3.10.1.
- Get-EXOMailbox -PropertySets: return archive, quota, hold or delivery propertiesGet-EXOMailbox returns only the Minimum property set. -PropertySets Archive, Quota, Hold or Delivery adds the rest; the valid values read from module 3.10.1.
- Get-EXOMailbox -ResultSize Unlimited: return more than 1000 mailboxesGet-EXOMailbox returns at most 1000 mailboxes unless you add -ResultSize Unlimited. Accepted values, binding errors and how to keep large tenant reports fast.