

Now, unless you use PowerShell regularly, chances are, you’re better off using the first method I described earlier. There is also another code where you can sniff out all the deleted sites: #Get All Deleted Sites Write-host -f Yellow "Could not Find Deleted site:"$DeletedSiteURL Write-Host -f Green "Site Collection '$DeletedSiteURL' Restored Successfully!" Restore-PnPTenantRecycleBinItem -Url $DeletedSiteURL -Force -ErrorAction Stop #restore site collection sharepoint online powershell $DeletedSite = Get-PnPTenantRecycleBinItem | Where Simply use the code below (credits to Salaudeen Rajack): #Config VariablesĬonnect-PnPOnline -Url $TenantURL -Credentials (Get-Credential)

This other method is effective if you know the site that was accidentally deleted. The system will then confirm to you the restoration of the site along with its assets.Ĭonfirm your decision by clicking the restore button from the dialogue box.
