Command
Import-UserAndGroupMapping
Description
The command to import the user and group mappings from a file.
To learn more about your user and group mappings and how to export and import a ShareGate user mappings file (SGUM), see Map users and groups.
Examples
Import mappings from a file
# Import the user and group mapping from the specified file
$mappingSettings = Import-UserAndGroupMapping -Path "C:\MyMappings\MyUserAndGroupMappingsFileName.sgum"
# Display the imported mapping settings
$mappingSettings
# Output:
# PropertyMappings :
# ContentTypeMappings :
# UserAndGroupMappings : CustomPermissions Members -> Sales&Marketing Owners
# i:0#.w|office\sg.achille -> i:0#.w|office\sg.baptiste
# i:0#.w|office\sg.camille -> i:0#.w|office\sg.denis
# PermissionLevelMappings :
# SiteTemplateMappings :
Merge mappings with mappings from a file
# Create and update user and group mappings
$mappingSettings = Set-UserAndGroupMapping -Source "John Doe" -Destination "Paul Smith"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -Source "myusername" -Destination "anotherusername"
# Map unresolved users or groups to "Old employee Group"
$mappingSettings = Set-UserAndGroupMapping -MappingSettings $mappingSettings -UnresolvedUserOrGroup -Destination "Old employee Group"
# Import additional mappings from the specified file, merging with the current settings
$mappingSettings = Import-UserAndGroupMapping -MappingSettings $mappingSettings -Path "C:\MyMappings\MyUserAndGroupMappingsFileName.sgum"
# Display the final mapping settings
$mappingSettings
# Output:
# PropertyMappings :
# ContentTypeMappings :
# UserAndGroupMappings : <Unresolved users or groups> -> Old employee Group
# CustomPermissions Members -> Sales&Marketing Owners
# i:0#.w|office\sg.achille -> i:0#.w|office\sg.baptiste
# i:0#.w|office\sg.camille -> i:0#.w|office\sg.denis
# John Doe -> Paul Smith
# myusername -> anotherusername
# PermissionLevelMappings :
# SiteTemplateMappings :
Syntax
Import-UserAndGroupMapping-Path <String> [-MappingSettings <MappingSettings>]
Parameters
-MappingSettings <MappingSettings>
Specifies the mapping settings. This command can add multiple mapping settings to an existing mapping settings object. For more details, see Use multiple mapping files at once.
Required? | False |
Default value | None |
Accept pipeline input? | True (ByValue, ByPropertyName) |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | None |
-Path <String>
Specifies the file path that was previously exported with Sharegate.
Required? | True |
Default value | None |
Accept pipeline input? | False |
Accept wildcard characters? | False |
Parameter set name | (All) |
Aliases | PSPath |