Hi anonymous user,
According to my research and testing, you can install SharePoint Migration Tool to do the migration. And you can use the following PowerShell script to migrate pages from SharePoint 2016 to SharePoint Online:
$SourceSiteUrl = "http://sp/sites/xxx"
$OnPremUserName = "xxx\xxxx"
$OnPremPassword = ConvertTo-SecureString -String "<<PassWord>>" -AsPlainText -Force
$SPCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $OnPremUserName, $OnPremPassword
$SourceListName = "xxx"
#Define SharePoint target#
$SPOUrl = "https://xxxxx.sharepoint.com/sites/xxxx"
$UserName = "******@xxxxx.onmicrosoft.com"
$PassWord = ConvertTo-SecureString -String "<<PassWord>>" -AsPlainText -Force
$SPOCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $UserName, $PassWord
#Import SPMT Migration Module#
Import-Module Microsoft.SharePoint.MigrationTool.PowerShell
#Register the SPMT session with SharePoint 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
#Start Migration in the console. #
Start-SPMTMigration
My test results:
Use the following PowerShell script to convert all classic pages to modern pages:
#Set Parameters
$SiteURL="https://xxxxx.sharepoint.com/sites/xxxxx"
#Connect to Site
Connect-PnPOnline $SiteURL -Credentials (Get-Credential) #-Interactive
#Get All Pages from "Site Pager" Library
$Pages = Get-PnPListItem -List SitePages -PageSize 500
ForEach($Page in $Pages)
{
#Get the page name
$PageName = $Page.FieldValues.FileLeafRef
Write-host "Converting Page:"$PageName
#Check if the page is classic
If($Page.FieldValues["ClientSideApplicationId"] -eq "b6917cb1-93a0-4b97-a84d-7cf49975d4ec")
{
Write-host "`tPage is already Modern:"$PageName -f Yellow
}
Else
{
#Conver the classic page to modern page
ConvertTo-PnPPage -Identity $PageName -Overwrite -TakeSourcePageName -AddPageAcceptBanner
Write-host "`tPage Converted to Modern!" -f Green
}
}
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.