
Hi @OL
Thank you for posting your question in the Microsoft Q&A forum.
As moderators, we have certain limitations within our test environment, which unfortunately prevent us from fully reproducing the issue you've encountered. After thorough research, I found this helpful article Start-SPMTMigration (Microsoft.SharePoint.MigrationTool.PowerShell) | Microsoft Learn which may meet your requirement.
You may take this PowerShell script from Microsoft as a reference for automating SharePoint migration using the SharePoint Migration Tool.
# Define SharePoint 2013 data source
$SourceSiteUrl = "https://YourOnPremSite/"
$OnPremUserName = "Yourcomputer\administrator"
$OnPremPassword = ConvertTo-SecureString -String "OnPremPassword" -AsPlainText -Force
$SPCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OnPremUserName, $OnPremPassword
$SourceListName = "SourceListName"
# Define SPO target
$SPOUrl = "https://contoso.sharepoint.com/"
$UserName = "******@contoso.onmicrosoft.com"
$PassWord = ConvertTo-SecureString -String "YourSPOPassword" -AsPlainText -Force
$SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $PassWord
$TargetListName = "TargetListName"
# Define File Share data source
$FileshareSource = "YourFileShareDataSource"
# Import SPMT Migration Module
Import-Module Microsoft.SharePoint.MigrationTool.PowerShell
# Register the SPMT session with SPO credentials
Register-SPMTMigration -SPOCredential $SPOCredential -Force
# Add two tasks into the session. One is SharePoint migration task, and another is
# File Share migration task.
Add-SPMTTask -SharePointSourceCredential $SPCredential -SharePointSourceSiteUrl $SourceSiteUrl -TargetSiteUrl $SPOUrl -MigrateAll
Add-SPMTTask -FileShareSource $FileshareSource -TargetSiteUrl $SPOUrl -TargetList $TargetListName
# Start Migration in the console.
Start-SPMTMigration
I hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.