SharePoint 2013 Mega Menu (MMS driven) - How to replicate the same mega menu for all the web applications and all the site collections? The mega menu is only available for 1 site collection. Is there a powershell way to propagate mega menu from source to all the site collections among all the web applications (about 500 sites)
1 Answer
If the mega menu has been applied on a master page, so you can apply the same master page to all site collections within a web application using the below PowerShell Script
$site= Get-SPSite HTTP://webappURL #rootsiteURL
$WebApp = $Site.WebApplication
foreach($spSite in $WebApp.Sites)
{
foreach ($web in $spSite.AllWebs)
{
$web.MasterUrl = $site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/YourMasterPage.master";
$web.CustomMasterUrl = $site.RootWeb.ServerRelativeUrl + "/_catalogs/masterpage/YourMasterPage.master";
$web.Update();
}
}
Repeat the above steps for each web application on your farm
Note: I would suggest creating a new web application with multiple site collections on a test environment to test the above script before applying it on the production
-
Thanks for the reply. I dont recall using masterpage for the mega menu. Is that where you have to change the child stuff in the masterpage? Jan 22, 2021 at 15:36