I have deleted a subsite “Subsite 001” from a site collection, which moved to the Site Collection (Second Stage) recycle bin. In this blog, you will see how to restore a subsite from the second stage recycle bin using PnP PowerShell.
Copy the below script and paste it in a notepad. Save the file as RestoreSubsite.ps1.
- # Input Parameters
- $credentials=Get-Credential
- $URL="https://c986.sharepoint.com/sites/dev/"
- $title="Subsite 001"
- # Connect to SharePoint Online
- Connect-PnPOnline -Url $URL -Credentials $credentials
- Get-PnPRecycleBinItem | ? Title -eq $title | Restore-PnPRecycleBinItem
Open PowerShell window and run the following command.
- >cd "<folderlocation>"
folderlocation – RestoreSubsite.ps1 file location
Run the following command
- >.\RestoreSubsite.ps1
Reference - Restore-PnPRecycleBinItem
Thus in this blog, you saw how to restore a subsite from SharePoint Online using PnP PowerShell.

Join the conversation! Your thoughts help the community grow.