SharePoint Restore a deleted Site Collection

It might not be often that your customers or colleagues ask you “what template did you choose for the site XY?” and you ask them back “Why?” thinking that he might want to create a second site of this template, but his answer is short and precise: “Well, i deleted it accidently”. Mmh… accidently… You hit on site actions – site settings – delete this site and hit again the “are you sure”-confirmation button – by mistake?… Ok…

Two things which are elementary for using SharePoint: a) Training and b) Powershell.

So you can tell your customer, that you will restore the site collection accidently by running this powershell shell script unintended 🙂

[sourcecode language=”csharp”]

Add-PSSnapin Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue

Restore-SPDeletedSite -Identity


At first we need to get the Site Id. There fore the first line. In the second line we put our site id into the “<>” and afterwards the site should be there.

To learn more about it:

Hope you do not use it often. But if you need to use it more than 3 times a week, please refer to the elementary points (point a) of this blog.


The article or information provided here represents completely my own personal view & thought. It is recommended to test the content or scripts of the site in the lab, before making use in the production environment & use it completely at your own risk. The articles, scripts, suggestions or tricks published on the site are provided AS-IS with no warranties or guarantees and confers no rights.

About Karsten Schneider 312 Articles
Consultant for Microsoft 365 Applications with a strong focus in Teams, SharePoint Online, OneDrive for Business as well as PowerPlatform with PowerApps, Flow and PowerBI. I provide Workshops for Governance & Security in Office 365 and Development of Solutions in the area of Collaboration and Teamwork based on Microsoft 365 and Azure Cloud Solutions. In his free time he tries to collect tipps and worthy experience in this blog.

Be the first to comment

Leave a Reply

Your email address will not be published.