Tuesday, December 23, 2014

Reset to Site Definition via PowerShell in SharePoint

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 - 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 ="https://intranet.crescent.com/sites/operations/us"

$web =  Get-SPWeb $SiteURL
Lets do it for All sites under the site collection:
$SiteURL ="https://intranet.crescent.com"

#Revert all webs to site definition
Get-SPSite $SiteURL | Get-SPWeb | foreach-object {
 Write-Debug "Site Resetted: $($web.Url)"
 All customizations will be reverted once the operation completed.

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...