Link to home
Start Free TrialLog in
Avatar of vmdude
vmdudeFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Exchange Powershell Script for exporting email addresses

Hello,

I'm looking for a way of using powershell to export all email aliases associated with an individual mailbox to a CSV file.

I am then looking for another powershell script to import that information to a different mailbox. The mailbox is in a different Exchange forest which is sharing the SMTP namespace so there will be no conflict of proxy addresses.

Thanks in advance
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Use the following command to export the user mailboxes which references the Alias and PrimarySMTPAddress, and export the results to CSV
Get-Mailbox -ResultSize "unlimited" | Select Alias, PrimarySmtpAddress |
Export-csv "c:\mailboxes.csv" -nti

Open in new window


Thats it.

Will.
Avatar of vmdude

ASKER

Hi Will,

Thanks for your comment, however I am looking to export all aliases for a specific user to CSV.
So for example;

I know a user called Joe Bloggs has got 30 email addresses as other admins have un-checked the "Automatically update e-mail addresses based on email address policy" and have manually added a world of other adresses.

What I want to do is export all email addresses associated with Joe Bloggs to a CSV and then take that CSV and import to a new user (also called Joe Bloggs) in a different forest.
you can use the below script instead

Start-Transcript
Get-Mailbox -ResultSize "unlimited" | Select Alias, EmailAddresses
Stop-Transcript

then open the transcript file (u will see the path in the command shell) and you can use it
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vmdude

ASKER

Hi Will,

Yes that is exactly what I am after thank-you. Final question then... how do I take that information and import it to the new user?
Not sure why you graded this answer a B if it was exactly what you were looking for. You never gave me an opportunity to answer your last comment. However this would be considered a new question, so it should be opened and i would be glad to assist with that.

Will.
Avatar of vmdude

ASKER

Hi Will,

Fair comment, I will see if I can retract and upgrade to A