Skip to main content
All CollectionsMigratePowerShellTips and tricks
Use multiple mapping files at once
Use multiple mapping files at once
Updated this week

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 whole 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.

$srcSite = Connect-Site -Url "http://myfarm1/sites/mysourcesite"
$dstSite = Connect-Site -Url "http://myfarm2/sites/mydestinationsite"
$result = Copy-Site -Site $srcSite -DestinationSite $dstSite -Merge -MappingSettings $mappingSettings
$result  
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?