# Generates a ShareGate Desktop user mapping file (.sgum) from a CSV document.
# Use the user mapping file for your migrations in the application or in PowerShell.
# Note: The application will map your users automatically.
# Any users you do not add in your mapping file will be mapped by ShareGate Desktop.
# From the CSV file with two columns named SourceValue and DestinationValue.
# You can use email, username, display name, or full name.
# SourceValue, DestinationValue
# <username>, <Firstname.surname>@domain.com
Import-Module Sharegate
$csvFile = "C:\CSVfile.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:\FolderName\FileName"
