The Command
Get-Recipient -Resultsize unlimited | select name, primarysmtpaddress, Database | export-csv C:\temp\addresses.csv -NoTypeInformationRun this from the Exchange Management Shell.
-Resultsize unlimited is important — without it, Exchange caps results at 1000 recipients by default, which silently truncates the list on any reasonably sized organisation. -NoTypeInformation drops the type-header line from the CSV, which most downstream tools (Excel, Power BI, another script) don’t expect.
FAQ
Can I filter to just user mailboxes, not distribution groups or contacts?Yes — use
Get-Mailbox instead of Get-Recipient, which returns only actual mailboxes rather than every recipient type in the organisation.
Can I add more columns, like department or job title?Yes, but not from
Get-Recipient/Get-Mailbox directly — those properties live on the Active Directory user object (on-prem) or the Entra ID/Exchange Online user object, not the mailbox object. Pull them with Get-User instead, or join the two datasets: Get-Mailbox -ResultSize Unlimited | Get-User | Select Name, Department, Title, PrimarySmtpAddress pulls both mailbox and directory attributes in one pipeline.
Does this work the same on Exchange Online?Yes, once you’re connected via
Connect-ExchangeOnline. On larger Exchange Online tenants specifically, the newer Get-EXORecipient/Get-EXOMailbox cmdlets are worth switching to instead — they’re REST-based and hold up better on large result sets than the classic Get-Recipient/Get-Mailbox cmdlets, which are more prone to timing out on very large pulls.
Resources
Gear We Recommend
A few general tech accessories worth having alongside this.
Browse our General Tech Accessories picks on AmazonAs an Amazon Associate, TechyGeeksHome earns from qualifying purchases.
Discover more from TechyGeeksHome
Subscribe to get the latest posts sent to your email.