List Email Addresses for a User In Exchange 2010 CLI

From Bonus Bits
Jump to: navigation, search


How to list all the assigned email addresses of a mailbox in Exchange 2010 using Exchange Management Shell (PowerShell).

List User Mailbox Display Names

Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,ServerName,PrimarySmtpAddress

List a Single User Mailbox

  1. Get-Mailbox -Identity <DisplayName> | Select -Property EmailAddresses

Export All User Mailbox SMTP Addresses to CSV

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=EmailAddresses;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq smtp} | ForEach-Object {$_.SmtpAddress}}} | Export-CSV c:\smtp.csv -NoTypeInformation

Export a Single Users SMTP Address List to Text File

<syntaxhighlight lang="powershell" enclose="div">(Get-Mailbox -Identity <DisplayName> | Select-Object {Name="EmailAddresses";Expression={$_.EmailAddresses | Where-Object {$_.PrefixString -ceq "smtp"} | ForEach-Object $_.SmtpAddress}}}).EmailAddresses | Out-File -FilePath C:\username_smtp_addresses.txt -Encoding ASCII