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
https://blogs.technet.microsoft.com/samdrey/2018/04/29/powershell-script-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?
http://msexchangeteam.in/export-exchange-contacts-to-pst-or-csv/

How to export a list of mailboxes to a CSV file
https://www.codetwo.com/kb/export-exchange-mailboxes-list

or use purpose built tools

Move mailboxes using MigrationWiz
https://jaapwesselius.com/2014/11/27/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