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:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...