Every ShareGate migration to a local file share seems to end with the same surprise: all copied files suddenly show the day of the migration as their Created and Modified timestamps. That breaks auditing trails and confuses users. Fortunately, the ShareGate export already ships the real metadata, and a compact PowerShell script can write it back in minutes.
Why ShareGate overwrites the timestamps
When you export libraries or OneDrive content, ShareGate stores every relevant property in a CSV file. Copying the files to NTFS with Explorer or RoboCopy, however, creates new timestamps by design. The CSV therefore becomes the single source of truth for the original Created and Modified values, and PowerShell can reapply them exactly where they belong.
Export the CSV from ShareGate

The CSV lists each destination path plus the original dates. PowerShell can iterate through the rows, map them to the migrated files, and restore the metadata one by one.
PowerShell script for Created and Modified attributes
Prepare the environment
Save the ShareGate CSV on the file server and note the root folder that contains the migrated data set. Substitute both paths in the script before running it so the import can find the file and the loop can resolve the NTFS paths.
Run the script
$csv = Import-Csv "E:\Export\ShareGateAttributes.csv" -Delimiter ';'
$RootFolder = "E:\ShareGate Export\"
# Process each line from the CSV
$csv | ForEach-Object {
# Normalize the ShareGate destination path for NTFS
$filePath = $RootFolder + $_.DestinationPath.Replace("/", "\")
try {
(Get-Item $filePath).CreationTime = Get-Date $_.Created
(Get-Item $filePath).LastWriteTime = Get-Date $_.Modified
}
catch {
Write-Error $_ -BackgroundColor Red
}
}
The loop reads every row, converts the ShareGate destination to a Windows path, and assigns the original timestamps back to the target file.
How the script works
Import-Csvloads the file and exposes each column as a property.ForEach-Objectretrieves the local item viaGet-Item.- The
CreationTimeandLastWriteTimemembers receive theCreatedandModifiedvalues. - Any missing files trigger an error so you can rerun the migration for those paths.
With just a few lines of PowerShell you can keep your compliance trail intact and deliver migrated data that still mirrors the real editing history.