Migration Error from on-premise to SharePoint Online in Office 365
Copying to an Office 365 Site Collection requires Custom Scripts to be enabled at the destination
Using the Sharegate Desktop to Migrate on-premise team sites to Office 365 failed with Custom Scripts error
I was able to resolve this with the following script:
asnp *office*
$adminUPN="Admin@orgname.onmicrosoft.com"
$orgName="OrgName"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
$sites = Get-SPOSite -Limit all
foreach ($site in $sites)
{
Set-SPOSite $site -DenyAddAndCustomizePages 0
}
Please make sure you understand the security implications of this change. In my case, I was able to re-enable custom scripts on most of the sites following the migration without errors.
Prerequisite is the SharePoint Online Management Shell
Comments