To Re-ghost customized SharePoint sites and pages, We use “Revert to Site definition” via

  • Site Settings >> under Site Actions section, click on Reset to site definition 
  • Choose a specific page or entire site. Click on Reset! .
Reset to Site Definition using PowerShell in SharePoint

Reset to site definition – what does it do?
Reset to Site Definition removes any customizations and reverts the file back to the version originally deployed via the Site Definition. Customized pages are stored in the Content Database (a copy with changes) and are called unghosted. When you reset, the customized copy gets deleted and the version on the file system (the Site Definition version) is used.

Reset to Site Definition via PowerShell
When you have to reset a Site or List to its definition in bulk, PowerShell can be utilized.

Add-PSSnapin microsoft.sharepoint.powershell -ErrorAction SilentlyContinue

$WebURL =""

$web =  Get-SPWeb $SiteURL

Let’s do it for All sites under the site collection:

$SiteURL =""

#Revert all webs to site definition
Get-SPSite $SiteURL | Get-SPWeb -Limit All | foreach-object {
 Write-Debug "Site Resetted: $($web.Url)"

All customizations will be reverted once the operation completed.

Source link