SharePoint Migration Tool (SPMT)
This tool allows you to migrate lists or files from your SharePoint on-premises document libraries or from your on-premises file shares and easily move them to either SharePoint or OneDrive in Office 365. It is available to Office 365 users.
In the latest version, Microsoft has introduced PowerShell cmdlets to perform migration that has all features of the SharePoint Migration Tool (SPMT).
Click here to download the SPMT latest version 2.1.100.0 (currently in open beta). The PowerShell .dll's will be copied to %userprofile%\Documents\WindowsPowerShell\Modules location.
Copy the below script and paste it in a Notepad. Save the file as SPMTMigration.ps1.
- # Module Location
- $Global:ModulePath = "C:\Users\vijai\Documents\WindowsPowerShell\Modules\Microsoft.SharePoint.MigrationTool.PowerShell"
-
- # File Share Source Location
- $Global:FileShareSource = "C:\Users\vijai\Desktop\DeploymentAutomation"
-
- # SharePoint Online Target Site Details
- $Global:SPOUrl = "https://c986.sharepoint.com/sites/dev"
- $Global:SPOCredential = Get-Credential
- $Global:ListName="Documents"
-
- # Import SPMT Module
- Import-Module ($modulePath + "\Microsoft.SharePoint.MigrationTool.PowerShell.psd1")
-
- # Create a migration session and initialize it
- Register-SPMTMigration -SPOCredential $Global:SPOCredential -Force
-
- # Add a new migration task to the registered migration session
- Add-SPMTTask -FileShareSource $Global:FileshareSource -TargetSiteUrl $Global:SPOUrl -TargetList $Global:ListName
-
- # Start the registered SPMT migration
- Start-SPMTMigration
-
- # Cancel the current migration session
- Stop-SPMTMigration
-
- # Remove the SPMT migration session created
- Unregister-SPMTMigration
Open PowerShell window and run the following command.
folderlocation – where the SPMTMigration.ps1 file is saved
Run the following command
Enter the SharePoint Online site credentials in the pop-up and enter OK. After a few minutes, the files from folder share will be migrated to SharePoint Online site.
Reference - https://docs.microsoft.com/en-us/powershell/module/spmt/?view=spmt-ps
Thus, in this blog, you saw how to migrate files from Folder Share to SharePoint Online using PowerShell based on the SharePoint Migration Tool (SPMT) migration engine.