Translate

Monday, February 19, 2024

ShareGate : Create user mapping file

 User mapping file is essential for migrating user permissions. OneDrive and SharePoint sites can migrate the user permissions, as long as the users are present in both tenants. Below is the script which can be used to create the user mapping file (.sgum). 

  • Create a CVS file with two columns, SourceValue and DestinationValue
  • Add the user UPNs and save the file
  • Change the $csvFile variable to point to your CSV file
  • Run the script and get the out file from "C:\Temp\"

import-Module Sharegate
$csvFile = "C:\Temp\usrprmmapping.csv"
$table = Import-CSV $csvFile -Delimiter ","
$mappingSettings = New-MappingSettings
foreach ($row in $table) {
    $results = Set-UserAndGroupMapping -MappingSettings $mappingSettings -Source $row.SourceValue -Destination $row.DestinationValue
    $row.sourcevalue
}
Export-UserAndGroupMapping -MappingSettings $mappingSettings -Path "C:\Temp\usermappingfile"