This is an example demonstrating how to use our powerful mapping feature in PowerShell. You can use this feature to map Users and Groups, Properties, Content Types, Permission Levels and Site Templates.
- After you've launched Sharegate, the first thing you'll see is the Home Screen. To start a migration, click the "Start Migration" tile.
- You can launch a PowerShell Window and type Import-Module Sharegate.
PS C:\> Import-Module Sharegate
Or, you can launch PowerShell with Sharegate that will automatically import the Sharegate module.
- First you need to create a new set of mapping settings that will be used later for the copy. To do so, execute the New-MappingSettings command and store the result in a variable.
PS C:\> $mappings = New-MappingSettings
If you check to content of the variable mappings so far you should have an empty set of mappings
PS C:\> $mappings PropertyMappings : ContentTypeMappings : UserAndGroupMappings : PermissionLevelMappings : SiteTemplateMappings :
- Now you can create a property mapping that will be applied to all the lists in my site during the copy if the properties mapped are available (see Set-PropertyMapping).
PS C:\> Set-PropertyMapping -MappingSettings $mappings -Source PropertyA -Destination PropertyB PropertyMappings : PropertyA -> PropertyB ContentTypeMappings : UserAndGroupMappings : PermissionLevelMappings : SiteTemplateMappings :
Note that all Sharegate mapping commands return the resulting mapping settings object, so you can easily pipe all the commands or simply see the result after each command.
- We are now ready to copy our site with these mappings, so all PropertyA columns will be mapped to PropertyB columns in every list that has these columns defined.
PS C:\> $srcSite = Connect-Site -Url http://myfarm1/sites/mysourcesite PS C:\> $dstSite = Connect-Site -Url http://myfarm2/sites/mydestinationsite PS C:\> $result = Copy-Site -Site $srcSite -DestinationSite $dstSite -Merge -MappingSettings $mappings PS C:\> $result Result : Operation completed successfully. SessionId : 140221-1 SiteObjectsCopied : 3 ItemsCopied : 189 Warnings : 0 Errors : 0 PS C:\> Export-Report $result -Path C:\MyReports\CopySiteReports.xlsx Report exported with success to: C:\MyReports\CopySiteReports.xlsx