Turn off Publishing Infrastructure before Migrating from On-Premises to the M365 Cloud

Having classic publishing activated in thousands of site collections in your tenant WILL slow down your network. M365 does not expect this feature to be activated and this is a common newbie error in migrations. Luckily, there is PowerShell to turn it off across the board if needed. Or, we suppose an ask could be made to site collection admins to turn it off manually across thousands of sites in site collections.

Hey 1990’s internet and IBM 386 PC network experience, why everything is so slow????

Hint: It is because classic publishing prevents Minimal Download strategy from doing it’s magic and the load is shifted away from the cloud servers onto the individual PC’s

SMAT said not to do that

There is a reason that the SharePoint Migration Assistant Tool (SMAT) Report reports about the number of sites with the classic publishing features active, and that is………………………

Because Classic Publishing is not supported in modern sites! Microsoft couldn’t be clearer about it, if they were air molecules in a vacuum chamber, click here to read all about it.

After publishing is turned off at both the site and site collection level, and in that order, turn on Minimal Download Strategy in the site’s features. Site Settings > Manage Site Features > Minimal Download Strategy.

Publishing Feature names and location to deactivate

SharePoint Server Publishing Infrastructure (Deactivate this last) Site Collection Features

SharePoint Server Publishing (Deactivate this first) Site Features

Minimal Download Strategy adds speed, click here to read about it. It’s a site feature and it might show activated in an auto magical way, if the site had had publishing erroneously activated in the former on-premises farm. Don’t worry about that, that is ok.

If asking one site collection admin to manually turn off publishing on say 9,000 some site collections because she has been made an SCA of more than

Oh, Shoot and oopsie, we didn’t know how serious of a foo paux this was and we already migrated 18K plus sites to our tenant and now everything is super slow….how can we turn it off en masse??

Pro Tip:


#Parameters
$TenantAdminURL = "https://crescent-Admin.sharepoint.com"

 
#Connect to Admin Center
Connect-PnPOnline -Url $TenantAdminURL -Interactive
 
#Get All Site collections - Exclude: Seach Center, Mysite Host, App Catalog, Content Type Hub, eDiscovery and Bot Sites
$SitesCollections = Get-PnPTenantSite | Where -Property Template -NotIn ("SRCHCEN#0", "REDIRECTSITE#0", "SPSMSITEHOST#0", "APPCATALOG#0", "POINTPUBLISHINGHUB#0", "EDISC#0", "STS#-1") 



#Site Collection feature "SharePoint Server Publishing Infrastructure"
$SiteCollFeatureId = "f6924d36-2fa8-4f0b-b16d-06b7250180fa" #Site Scoped Publishing Feature

#Site Feature ID "SharePoint Server Publishing"
$SiteFeatureId = "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" #Web Scoped Publishing Feature 

#Loop through each site collection
ForEach($Site in $SitesCollections)
{
    #Connect to site collection
    Write-host -f Yellow "Trying to Deactivate the Site feature on site:"$Site.Url   
    Connect-PnPOnline -Url $Site.Url -Interactive

#Get the Feature
$SiteCollFeature = Get-PnPFeature -Scope Site -Identity $SiteCollFeatureId
$SiteFeature = Get-PnPFeature -Scope Web -Identity $SiteFeatureId

#Check if feature is activated
If($SiteFeature.DefinitionId -ne $null) -or ($SiteCollFeature.DefinitionId -ne $null)
{
    #Disable site feature
    Disable-PnPFeature -Scope Web -Identity $SiteFeatureId -Force
    Write-host -f Green "`tSite Feature Deactivated Successfully!"

#Disable site collection feature
    Disable-PnPFeature -Scope Site -Identity $SiteCollFeatureId -Force
    Write-host -f Green "`tSiteColl Feature Deactivated Successfully!"
}
Else
{
    Write-host -f Cyan "`tPublishing Features were not active!"
}

}

P.S. The if portion of the loop could have MDS added after the Site Collection Feature is deactivated in order to turn on the Minimal Download Strategy, a few other modifications would be made before that part is done, e.g. there would be a variable for the MDS feature ID, a line to get that patterns and practices feature, another or in the intial collection, and an enable PnPfeature, maybe a couple other things. I didn’t feel like adding that part to this post.

Please reach out if you have trouble with this script, want an updated version with MDS, or if it doesn’t work in your environment.

If it doesn’t work, it could be due to MFA.

In that case, you might try using the Use web login versus interactive. This is often the case in some government cloud tenants.

One final point to share, see what I did there, a point to share about SharePoint, ha ha ha….

This post, at the link below, about classic publishing does not pertain to M365 SharePoint and it is what helped get us to the slow site situation we’re in because the feature was not deactivated in the on premises site before going hog wild with the migration software….click here to learn more about on-premises Publishing, paying special attention to the versions of SharePoint to which it pertains.

Have a great [insert your company or client name here] day!