Home » Microsoft » Exchange 2010 » Exchange 2010 – Export all SMTP email addresses to file

Exchange 2010 – Export all SMTP email addresses to file

This Powershell script is very helpful if you want to have all email addresses in the Exchange organization.

Save the following script to a .ps1 file and execute from Exchange Powershell:

cls

write-host "`nSMTP Address export to file `n`n`n"
write-host "Where do you want to store the export-file?  (c:\smtpexport.csv)`n`n"

$location = read-host "enter path/filename"

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

You have to enter the path and filename for the .csv file.

Check Also

Exchange 2010 – Get Mailbox Database Mount status

Do you want to verify / check / see if you Mailbox Database is mounted …

Leave a Reply

Your email address will not be published. Required fields are marked *