Microsoft released nice features for SharePoint online one of them are the footer and the headers that you can customize. However, there are some scenarios already configured where this footer doesn’t work with the current design. There a possibility to remove those footer by interface but you need to remove one by one. With the power of PowerShell, we can disable all the Footers from all the existing Communication sites.
Note: You need to have the most recent versions of PNP to successfully run the PowerShell. To check the current version of your PowerShell.
Get-Module SharePointPnPPowerShell* -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
To update the PowerShell for the latest version:
Update-Module SharePointPnPPowerShell*
Below is the script that will allow removing the Footers from all the Communication sites from the Tenant. You need to be SharePoint admin to be able to detect all the Communication sites and Admin of the Site Collections to disable this functionality on site. If you’re not Admin of the Site Collection the Script will show to your the owner.
$loginUrl = "https://contoso-admin.sharepoint.com" #SharePoint Admin Center
$username = "contoso@contoso.com"
$password = "contoso"
$encpassword = convertto-securestring -String $password -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword
Write-Host "Connection SharePoint Admin" $loginUrl
Connect-SPOService -Url $loginUrl -Credential $cred
$sites = Get-SPOSite #Get all the sites
foreach ($site in $sites){
if ($site.Template -eq "SITEPAGEPUBLISHING#0"){
try{
Connect-PnPOnline -Url $site.url -Credentials $cred
$web = Get-PnPWeb
$web.FooterEnabled = $false
$web.Update()
Invoke-PnPQuery
Write-Host "Footer Disable on " $site.url
}
catch{
Write-Host "No permission:" $site.url "- Site admin:" $site.owner
}
}
}
Write-Host "Press any key to Close..."
$Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
No Permissions
If you haven’t permissions to disable the footer the PowerShell Script will show the Site Collections and Site Owner that you were not capable of deactivating the Footer. You can then contact the Site Owner with the PowerShell Script to deactivate the theme or explaining the steps that he can do manually on the Site Collection.
Connect-PnPOnline -Url SITEURL -UseWebLogin
$web = Get-PnPWeb
$web.FooterEnabled = $false
$web.Update()
Invoke-PnPQuery
Conclusion
When the process is finished, all the existing Communication Sites that you’ve permissions will not have the footer on the Site. On those that were not possible to deactivate the Footer, you’ll have an email to alert about this feature. Note that you can always activate this feature back on the SharePoint sites.
Thanks for the script!
In our case, the footer re-appears after 1-2 days. When I check the sites settings, the value is set to False. When I re-run the script, the footer disappears again. Is there a logic behind that?
Also I’m interested if there is a good way to manage the footers content (title and links) using PoSh?
Hey Marco,
I’ve also detected this behavior on the SharePoint Online, maybe Microsoft didn’t stable enough this footer piece on the first release. From my knowledge, I don’t think at the moment there is a way to control the Footer with PowerShell. We hope this happens soon.
It works really well for me
Thanks for the excellent guide