Powers-hell to migrate content

Occasional Contributor

Hello Everyone,

I am trying to find out a better Powershell which can be used to migrate content from on-prem drives to OneDrive for business. I have one from "SharePoint migration tool", however I would like that to be able to migrate 500 users at a time and able to ignore folders that are not required and "make modified date stamp" as per our requirements. The reason why we want to explicitly stamp modified date is because of "retention policies". We don't want to loose all the old content. Do we have one powershell like that? 


I am not an expert in PowerShell, please suggest me best solution. My client is not interested in using any third part tool. 


current powershell: 


#Define SPO target#
$Global:SPOUrl = ""
$Global:UserName = ""
$Global:PassWord = ConvertTo-SecureString -String "youpassword" -AsPlainText -Force
$Global:SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $Global:UserName, $Global:PassWord
$Global:TargetListName = "Documents"

#Define File Share data source#
$Global:FileshareSource = "C:\test"

#Import SPMT Migration Module#
Import-Module Microsoft.SharePoint.MigrationTool.PowerShell

#Register the SPMT session with SPO credentials#
Register-SPMTMigration -SPOCredential $Global:SPOCredential -Force

#Add two tasks into the session. One is SharePoint migration task, and another is File Share migration task.#
#Add-SPMTTask -SharePointSourceCredential $Global:SPCredential -SharePointSourceSiteUrl $Global:SourceSiteUrl -TargetSiteUrl $Global:SPOUrl -MigrateAll
Add-SPMTTask -FileShareSource $Global:FileshareSource -TargetSiteUrl $Global:SPOUrl -TargetList $Global:TargetListName

#Start Migration in the console. #

2 Replies
It should not be a problem a migration scenario using SPMT PS cmdlets....you will need to prepare a CSV / JSON File (check SPMT documentation) where you have the ODFB sites where you want to migrate the content

@Juan Carlos González Martín thanks for your reply. what about modified time stamp? can we also apply this change during the migration