Skip to main content
All CollectionsMigratePowerShellCopy mailboxes
Combine your mailbox and recipient mappings for PowerShell
Combine your mailbox and recipient mappings for PowerShell
Updated this week

When you export your mailbox and recipient mappings in the app, they are separated.

You can use the following script to combine the mappings you exported from the app for PowerShell:

# Import the mailbox mappings CSV file$sharegateMailboxesMapping = Import-Csv -Path ".\SharegateMailboxMappings.csv"# Import the recipient mappings CSV file$sharegateRecipientsMapping = Import-Csv -Path ".\SharegateRecipientMappings.csv"# Combine the mappings and remove duplicates based on the 'Source user id' property$combinedCsv = $sharegateMailboxMappings + $sharegateRecipientMappings | Sort-Object "Source user id" -Unique# Export the combined data to a new CSV file to be used in the mailbox copy PowerShell command$combinedCsv | Export-Csv -Path ".\ShareGatePowerShellMailboxMappings.csv" -NoTypeInformation

Adjust -Path ".\SharegateMailboxesMapping.csv" and -Path ".\SharegateRecipientsMapping.csv" to match your respective CSV file's location and file names.

Note: The mappings are already combined when you export them in PowerShell with Export-MailboxMappings.

Did this answer your question?