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.
Connect-ExchangeOnline (ExchangePowerShell)Get-EXOCasMailbox (ExchangePowerShell)Property sets in Exchange Online PowerShell module cmdlets (Get-EXOCasMailbox Minimum set)Set-CASMailbox: PopEnabled and ImapEnabled (default $true)Find the permissions required to run any Exchange cmdletAbout the Exchange Online PowerShell module: release notesWhere-Object (Microsoft.PowerShell.Core)Sort-Object (Microsoft.PowerShell.Utility)Select-Object (Microsoft.PowerShell.Utility)