Recover from a broken Master Page
Last night I had a bit of fun trying to fix a bad Master Page that prevented access to anything in a site collection via the browser. This Master Page had a reference to a SharePoint Feature that had since been retracted and removed. The solution was to use PowerShell to change the Master Page:
$Site = get-spsite “http ://SharePoint/Sites/SpecificSite”
$webcount = $Site.AllWebs.Count
$webs=$Site.AllWebs
for ($i=0; $i -lt $webcount; $i++)
{
$web=$webs[$i]
$Master=$web.get_MasterUrl()
$Master=$Master.Replace("your-custom-master", "v4.master")
$web.set_Masterurl($Master)
$web.update()
$web.dispose()
}
Want to talk?
Drop us a line. We are here to answer your questions 24*7.