Skip to main content
Use multiple mapping files at once
Updated over 4 months ago

PowerShell allows you to use multiple mapping files for migrating your objects or content.

Example

# Import a Content Type Mapping to a new Mapping Settings
$mappingSettings = Import-ContentTypeMapping -Path "C:\MyMappings\ContentTypeMappings.sgctm"

# Add a Property Mapping
$mappingSettings = Import-PropertyMapping -Path "C:\MyMappings\PropertyMappings.sgpm" -MappingSettings $mappingSettings

# Add a Permission Level Mapping
$mappingSettings = Import-PermissionLevelMapping -Path "C:\MyMappings\PermissionLevelMappings.sgrm" -MappingSettings $mappingSettings

# Add a User and Group Mapping
$mappingSettings = Import-UserAndGroupMapping -Path "C:\MyMappings\UserAndGroupMappings.sgum" -MappingSettings $mappingSettings

# Display the entire mapping settings
$mappingSettings

You can now use the $mappingSettings object in your copy command. The important thing to note is that each cmdlet that generates a mapping settings object has a switch called -MappingSettings which allows adding mapping settings to an existing mapping settings object.

# Connect to the source site
$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"

# Connect to the destination site
$dstSite = Connect-Site -Url "http://myfarm2/sites/mydestinationsite"

# Copy the source site to the destination site using mapping settings and merge option
$result = Copy-Site -Site $srcSite -DestinationSite $dstSite -Merge -MappingSettings $mappingSettings

# Display the result
$result

# Export the report to an Excel file
Export-Report $result -Path "C:\MyReports\CopySiteReports.xlsx"

For more information, see New Mapping Settings.

Tip: Print the result in the windows or export the migration report to an Excel file. For more information, see Export-Report.

Did this answer your question?