How to export the Mailbox information to .CSV so I can import it as mail contact

Hi All,

I need to export the Exchange server mailbox details, so I can generate the .CSV file to import as Mail-Contact in my new Exchange Server OnPremise using the script below:

Import-Csv "C:\TEMP\contact2.csv" | foreach {Set-Contact $_.externalemailaddress -Name $_.name -FirstName $_.firstname -LastName $_.lastname -StreetAddress $_.streetaddress -StateOrProvince $_.province -City $_.city -PostalCode $_.postalcode -MobilePhone $_.mobile -Phone $_.workphone -HomePhone $_.homephone -Company $_.company -Title $_.title -Department $_.department -CountryOrRegion $_.countryorregion -Fax $_.fax -Notes $_.notes -Office $_.office}

 

Any help would be greatly appreciated.

Thanks,

There a bunch of articles on this type of use case.

What have you searched for?

Search string ‘export exchange mailbox to csv’

Why have you tried?
Search string ‘export exchange mailbox to csv’

PowerShell scripts to Migrate Exchange Mailbox and Distribution Group Send As, Full Access and Send On Behalf Permissions into a CSV file–Part I : Export Script

How to Export Exchange Contacts to PST or CSV File Formats?

How to export a list of mailboxes to a CSV file

or use purpose built tools

Move mailboxes using MigrationWiz

Export Active Directory mailboxes and create MigrationWiz import file
https://help.bittitan.com/hc/en-us/articles/115008099867-Export-Active-Directory-mailboxes-and-create-MigrationWiz-import-file