Tuesday, 1 July 2014

Restore Deleted Site Collection using Powershell

PowerShell Script to Restore Deleted SiteCollection - Get SP deleted sites/ Find Deleted sites using Powershell


GetDeletedSites() Method will find the all the SP deleted sites in a WebApplication.


clear

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$webapp=Get-SPWebApplication -Identity "http://SP2013Dev"

$webapp.GetDeletedSites() 


OutPut:




















To Restore a deleted site , use SiteId as a bestPractice.

Restore-SPDeletedSite -Identity "9e960e21-92e1-43c1-9ad6-1a0396346e0e"









Note :

  1. If a site has been removed using Remove-SPSite by SharePoint Admin guys, then SPDeleteSite can't find your site.
  2. The Remove-SPSite cmdlet completely deletes an existing site collection and all subsites. This operation cannot be undone.
  3. So if you  try to restore same site using the powershell Get-SPDeletedSite command, will fail and can't restore the site.


No comments:

Post a Comment