How to Restore OneDrive For Business Site from Recycle Bin?

Requirement: Restore a Deleted OneDrive Site.

How to restore a OneDrive for Business Site using PowerShell?

When you remove a user from Office 365, his OneDrive is retained for 30 days, and then it’s deleted. When a OneDrive site for an Office 365 user is deleted, it is moved to the tenant recycle bin first. Then it is permanently deleted after the retention period of 93 days, typically. More information is here: How to set OneDrive Retention Period?

Sometimes users may accidentally delete their OneDrive for Business sites, resulting in the loss of important files and data. In this tutorial, we will show you how to restore OneDrive for Business sites from the recycle bin, allowing you to recover your lost data.

PowerShell to Restore a Deleted OneDrive Site

Recovering a OneDrive for Business site is relatively easy. Here is the PowerShell to restore the deleted OneDrive site.

Step 1: Connect to SharePoint Online from SharePoint Online Management Shell

Set the config parameter as per your tenant.

#Config Parameters

#Get Credentials to connect
$Cred = Get-Credential

#Connect to SharePoint Online Tenant Admin
Connect-SPOService -URL $AdminSiteURL -Credential $Cred
restore deleted onedrive site powershell

Step 2: Get All Deleted OneDrive Sites

Let’s check if the OneDrive site is in the recycle bin. To get all deleted OneDrive for Business site collections, use:

#Get All Deleted OneDrive Sites
Get-SPODeletedSite -IncludeOnlyPersonalSite -Limit All | Where { $_.URL -like "**"} 

This retrieves a list of OneDrive sites deleted and available for restoration.

Step 3: Restore the OneDrive Site from the Recycle bin

Once you find the OneDrive site from the above cmdlet, You can restore the OneDrive site using the following:

#Set OneDrive Site to Restore
$OneDriveSiteURL = ""

#Restore deleted onedrive site powershell
Restore-SPODeletedSite -Identity $OneDriveSiteURL

That’s it. Your site should be back! We’ve restored OneDrive for Business site using PowerShell. If you want to delete a OneDrive site permanently, you have to delete it from the recycle bin as in SharePoint Online: Delete Site Collection from Recycle bin using PowerShell


In conclusion, restoring a OneDrive for Business site from the recycle bin is a simple process that can be done by following the steps outlined in this tutorial. Following these steps, users can recover their lost files and data, and regain access to their OneDrive for Business site. It’s important to remember that the site will only be available in the recycle bin for 93 days after deletion, after that, it’s not recoverable.

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “How to Restore OneDrive For Business Site from Recycle Bin?

  • Can you please check the below command if correct for restore data from recycle bin of a user

    $SharePointSiteURL = “”

    # User who deleted files
    $UserEmailWhoDeletedFiles = “”

    # My Crds
    $SPOCreds = Get-Credential -UserName “” -Message “Password”

    # Connect
    Connect-PnPOnline -Credentials $SPOCreds -Url $SharePointSiteURL

    # Check Item Count
    $Items = Get-PnPRecycleBinItem | ? -Property DeletedByEmail -EQ $UserEmailWhoDeletedFiles

    #Restore All Items
    $Items = Get-PnPRecycleBinItem | ? -Property DeletedByEmail -EQ $UserEmailWhoDeletedFiles

    ForEach ($item in $items) {
    Restore-PnpRecycleBinItem -Identity $item -Force


Leave a Reply

Your email address will not be published. Required fields are marked *