0

When I´m using the GUI in Central Administration to delete a Site Collection.

How long after the deletion can I restore this site?

To restore a site I´m using the following command:

Restore-SPSite

https://technet.microsoft.com/en-us/library/ff607788.aspx

  • Do you want to restore same site or want to restore same site but different backup? – Waqas Sarwar MVP Jul 5 '16 at 15:37
5

You can't restore a site you deleted with Remove-SPSite. Microsoft is assuming that you know what you are doing when using powershell to delete a site collection, so there is no possibility to restore this site.

When adding -GradualDelete to the command, the site will placed in the DeletedSites, where you can restore it within 30 days after deletion (this equals the deletion in the GUI).

When using the interface of SharePoint and deleting the site by using the site settings -> "Delete this site". You will be able to get your deleted sites by using the command Get-SPDeletedSite and restore it by executing Restore-SPDeletedSite within 30 days.

If you want to use powershell for a permanent restore option, make sure to backup the site collection before deletion by using Backup-SPSite. You will then have the possibility to restore the site at anytime as long as you don't delete the .bak file you created with the backup command. To restore the .bak file you use the command Restore-SPSite.

  • Remove-SPSite is not the inverse of Restore-SPSite. It is the inverse of Backup-SPSite. – Jammin4CO Jul 5 '16 at 17:49
3

Once you execute Remove-SPSite it goes and removes the site. Once this command finished execution you can go ahead with the whatever next command.

So the answer is immediate after the execution of Remove-SPSite command.

  • But is there no PowerShell command to delete a Site Collection like the GUI way? – LaPhi Jul 6 '16 at 19:25
  • "Remove-SPSite $site -GradualDelete", is the equivalent to the GUI. – SunP Jul 18 '17 at 11:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.