Search This Blog

Wednesday, 8 February 2012

Export to CSV all your Exchange 2007/2010 Email Addresses

If you want to export all your users email addresses to a CSV so you can see who has which alias you can do this with this Power Shell Command

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

I have wrapped it here so just paste it in to Power Shell to run and this will show the Primary Email address and then all the alias addresses.

Thanks to Karl Mitschke for this information!

23 comments:

  1. Thank you very much, it is helping my work easier.

    ReplyDelete
  2. Amazing.

    Copied and pasted and the command into the shell and it created the smtp.csv file in the root directory on the C drive on my exchange server.

    Thank you very much!

    ReplyDelete
  3. This was very helpful, thank you!

    ReplyDelete
  4. Thanks very much for sharing!

    ReplyDelete
  5. how would you add mailbox size to this script?

    (BTW this is awesome, thanks for this!!)

    ReplyDelete
  6. Excellent! I changed the beginning to get-mailcontact and got the clean export I had been looking for. Thank you!

    ReplyDelete
  7. Very helpful and saved me hours. Thanks for sharing.

    ReplyDelete
  8. Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -contains “smtp”} | ForEach-Object {$_.SmtpAddress}}} is the proper context for Exchange 2010 and above

    ReplyDelete
  9. Thanks for this! Nice to have a command like this that works first time.

    ReplyDelete
  10. this is excellent. Saved me a lot of time/effort. Thanks.

    ReplyDelete