SharePoint Online Migration Tool – Scan File Failure:The item created time or modified time is not supported

When migrating to SharePoint Online / OneDrive for business, you could get the error:
Scan File Failure:The item created time or modified time is not supported

This seems because the file or folder doensnt have a (valid) creation date, in my case it had the value “4-3-1601 05:27:48”. To resolve this issue, the files need to get a valid creation / LastAccess date, to achieve this do the following:

# Open PowerShell and typ go to the folder with the files giving the error;
cd "c:\iterrors"

# Check the CreationTimme, LastAccessTim
Get-ChildItem -force | Select-Object Mode, Name, CreationTime, LastAccessTime, LastWriteTime | ft

# Get all files in the folder and change the CreationTime, LastAccessTime and LastWriteTime entry
$modifyfiles = Get-ChildItem -force | Where-Object {! $_.PSIsContainer}
foreach($object in $modifyfiles)
{
$object.CreationTime=("11/11/2019 12:00:00")
$object.LastAccessTime=("11/11/2019 12:01:00")
$object.LastWritetime=("11/11/2011 12:02:00")
}