This was my first SharePoint migration – from On-Premise to O365.

You can, of course, use SharePoint Migration Tool but I decided to find out how to do it with PowerShell 🙂

This task consist of 2 parts:

# SharePoint 2013 Management Shell side (On-Premise)

Export-SPWeb -Identity "https://SHAREPOINT_SITE_ROOT" -ItemUrl "SITE/LIST/LIBRARY_2Export"  -Path c:\migration\export.cmp -NoFileCompression

# SharePoint Online Management Shell side (as administrator)
Declaring needed variables:

$targetPackage = "c:\migration\target"
$sourcePackage = "c:\migration\export.cmp"
$targetDocLib = "SITE/LIST/LIBRARY_2Import"
$sourcePackagePath = "c:\migration\export.cmp"
$creds = Get-Credential
$targetWeb = "https://SHAREPOINT_SITE2_ROOT"

Converting exported files into a new migration package:

$convertToSPOMigrationTargetedPackage = @{
    OutputPackagePath = $targetPackage
    SourceFilesPath = $sourcePackage
    TargetDocumentLibraryPath = $targetDocLib
    SourcePackagePath = $sourcePackagePath
    Credentials = $creds
    TargetWebUrl = $targetWeb
ConvertTo-SPOMigrationTargetedPackage @convertToSPOMigrationTargetedPackage

Creating a new migration job in the target site collection:

$invokeSPOMigrationEncryptUploadSubmit = @{
    SourceFilesPath = $sourcePackage
    Credentials = $creds
    SourcePackagePath = $targetPackage
    TargetWebUrl = $targetWeb
Invoke-SPOMigrationEncryptUploadSubmit @invokeSPOMigrationEncryptUploadSubmit

That would be all 🙂 You have successfully moved your SharePoint data.

Have another great day in Admins life 🙂

Please follow and like us:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.