Tuesday, June 3, 2014

SharePoint 2010 remove customization (Reghost) a master page or page layout file

Use the below script and change file name to the desired object


---------------------------------------------------------------------------


$s = Get-SPSite "http://<server name>/"
$w = $s.RootWeb

$ps = New-Object Microsoft.SharePoint.Publishing.PublishingSite($s)
$pls = $ps.PageLayouts
    
      
    $f = $w.GetFile("/_catalogs/masterpage/<Page Layout Name>.aspx")
Write-Host $f.CustomizedPageStatus
    if ($f.CustomizedPageStatus -eq "Customized")
    {
        Write-Host
        Write-Host "Layout page name: " -NoNewline
        Write-Host $f.Name        
        Write-Host "Status before: " -NoNewline

        Write-Host $f.CustomizedPageStatus
         
        #$f.RevertContentStream()
      
        Write-Host "Status after: " -NoNewline
        Write-Host $f.CustomizedPageStatus
    }

    
$w.Dispose()
$s.Dispose()

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...