Skip to main content
Export-TenantUserMappings

Export a Microsoft 365 tenant-wide user mapping Excel file with PowerShell.

Updated over 2 months ago

Command

Export-TenantUserMappings

Description

The command to export an XLSX user mappings file based on your source and destination tenant users.

You can use the exported file to define new mapping settings with Import-TenantUserMappings.

Note: If identical users are found in the source and destination tenant, they're paired in the resulting XLSX file side by side. Users with no match in the destination tenant must be mapped manually.

Examples

Export all users from a source and destination tenant

# Connect to the source tenant using the specified domain
$sourceTenant = Connect-Tenant -Domain "sourceTenantDomain"

# Connect to the destination tenant using the specified domain
$destinationTenant = Connect-Tenant -Domain "destinationTenantDomain"

# Export user mappings from the source tenant to the destination tenant
Export-TenantUserMappings -SourceTenant $sourceTenant -DestinationTenant $destinationTenant -Path "C:\MyMappings\MyUsersMappings"

Syntax

Export-TenantUserMappings -SourceTenant <Tenant> -DestinationTenant <Tenant> -Path <String> [-Overwrite <SwitchParameter>]

Parameters

-DestinationTenant <Tenant>

Specifies the destination tenant.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Overwrite <SwitchParameter>

Specifies the file that will be overwritten if it already exists.

Required?

False

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-Path <String>

Specifies the path where you want to save the XLSX file.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

-SourceTenant <Tenant>

Specifies the source tenant.

Required?

True

Default value

None

Accept pipeline input?

False

Accept wildcard characters?

False

Parameter set name

(All)

Aliases

None

Did this answer your question?