Skip to main content
Exchange Online · PowerShell 7.6

Mailboxes with POP3 or IMAP4 still enabled

Which mailboxes can still be opened with POP3 or IMAP4 clients?

Script

#Requires -Modules ExchangeOnlineManagement
# Mailboxes with POP3 or IMAP4 access enabled. Read-only.

Connect-ExchangeOnline -ShowBanner:$false

Get-EXOCasMailbox -ResultSize Unlimited |
    Where-Object { $_.PopEnabled -or $_.ImapEnabled } |
    Sort-Object PrimarySmtpAddress |
    Select-Object @{ Name = 'Mailbox'; Expression = { "$($_.PrimarySmtpAddress)" } }, PopEnabled, ImapEnabled

Checked automatically against Microsoft's published cmdlet reference. KBY hasn't run it in your tenant; run it in a test environment first.

Reading the output

  • PopEnabled and ImapEnabled are in Get-EXOCasMailbox's default (Minimum) property set. Per the Set-CASMailbox reference, both are $true by default, so on many tenants every mailbox is listed until they are turned off.
  • Mailboxes that use neither protocol are better off with both disabled; each one left on is another way in.
  • ExchangeOnlineManagement 3.10.0 and later require PowerShell 7.6 when run in PowerShell 7 (Windows PowerShell 5.1 is unaffected), per the module release notes.

Sources

The Microsoft reference page for every cmdlet the script calls, plus the API and product pages behind each permission and caveat.

All scripts