Disable Footer on Communication site and subsites


You can remove the footer by interface but you need to remove one by one. This example is when you have a template of a Modern Communication site applied to sub-sites. With PNP PowerShell, we can disable all the Footers from the Communication site.

I have a previous post, where I’ve created a similar PowerShell to deactivate the theme on all the Communication sites, but will not get the footer disabled on subsites. For more information about that PowerShell script check the next link.

$loginUrl   = "https://contoso.sharepoint.com/sites/SITENAME/" #SharePoint site
$username   = "contoso@contoso.com"
$password   = "password"

$encpassword = convertto-securestring -String $password -AsPlainText -Force
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $encpassword

Connect-PnPOnline -Url $loginUrl -Credentials $cred
$web = Get-PnPWeb 
$web.FooterEnabled = $false
$web.Update()
Invoke-PnPQuery
Write-Host "Footer Disable on " $loginUrl

$subsites = Get-PnPSubWebs -Includes "WebTemplate","Configuration"
foreach ($site in $subsites){
 $sitesTemplate= $site.WebTemplate + "#" + $site.Configuration
  if ($sitesTemplate -eq "SITEPAGEPUBLISHING#0"){
   Connect-PnPOnline -Url $site.url -Credentials $cred
   $web = Get-PnPWeb 
   $web.FooterEnabled = $false
   $web.Update()
   Invoke-PnPQuery
   Write-Host "Footer Disable on " $site.url
  }
}

Conclusion

After you run this PowerShell script all the sub-site of that particular site collection will be disabled.

One Comment

Leave a Reply

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