Skip to main content

Import-MailboxMappings

Import Microsoft 365 Exchange Online and Google Workspace Gmail mailboxes and recipient mappings with PowerShell

Updated this week

Command

Import-MailboxMappings

Description

The command to import mailbox mappings from a file.

CSV mailbox mappings file

You can create a mapping file or generate one with ShareGate Migrate.

To export mappings with ShareGate Migrate, see Export-MailboxMappings.

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

To combine the mappings you exported from the app for PowerShell, see Combine your mailbox and recipient mappings for PowerShell.

If you export your mailbox mappings with the PowerShell cmdlet, your mappings are combined automatically.

If you want to create your own mapping file, you can export mailbox mappings with ShareGate Migrate to create a template and follow its formatting.

You can also create it manually as long as you follow the structure below and save it as a comma-delimited CSV.

Source user id

Source user name

Source user email

Destination user id

Destination user name

Destination user email

dd1558d5-66d1-4ca8-b1a7-ce1df75df9eb

Your User

916faa7c-4a37-42f3-9926-ddfda95522f3

Yourdestination User

Examples

Import mailbox mappings from a file

$filePath = "c:\MailboxMappingsToImport.csv"
$sourceConnection = Connect-MicrosoftOnline
$destinationConnection = Connect-MicrosoftOnline

Import-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath

Import mailbox mappings from the export mappings command result

$filePath = "c:\MailboxMappingsToImport.csv"
$sourceConnection = Connect-Google
$destinationConnection = Connect-MicrosoftOnline

# Export all mailbox mappings once, then reuse the file for your future import commands
Export-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath
Import-MailboxMappings -SourceConnection $sourceConnection -DestinationConnection $destinationConnection -Path $filePath

Syntax

Import-MailboxMappings
-SourceConnection <Connection>
-DestinationConnection <Connection>
-Path <FileInfo>

Parameters

-DestinationConnection <Connection>

Specifies the destination connection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Path <FileInfo>

Specifies the .csv file path to map the source mailboxes.

Required?

True

Default value

None

Accept pipeline input?

True (ByValue)

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-SourceConnection <Connection>

Specifies the source connection.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?