How to Delete a OneDrive for Business Site?

Requirement: Delete OneDrive for Business Site Collection! After a business decision was made to disable OneDrive organization-wide, We configured the settings to Disable OneDrive. However, All existing OneDrive sites were active, users could access them, and we wanted to remove them all!

Any SharePoint My Site or OneDrive for Business site gets deleted in 30 days (retention period) from the user account deleted from AD or when the license is deactivated for the user in Office 365.

How to Delete OneDrive for Business Site Collection?

If you no longer need a OneDrive for Business site, you can delete it by navigating to the URL https://tenant-my.sharepoint.com/personal/UserName_Tenant_com/_layouts/15/Deleteweb.aspx and then clicking on the “Delete” button. Replace the Tenant and User names accordingly.

sharepoint online delete onedrive

Deleting OneDrive for Business site collection is as same as deleting any SharePoint sites, But there is no way to delete it using browser UI. So, you can utilize the Remove-SPOSite cmdlet to delete any OneDrive for Business (My Site) site collection.

PowerShell to Delete a OneDrive for Business Site Collection

The OneDrive for Business site in your SharePoint Online environment can be deleted using PowerShell if you no longer require it. Use this PowerShell script on SharePoint Online Management Shell to remove a particular OneDrive site collection. Make sure you log in with SharePoint Online Administrator or Tenant admin credentials.

$AdminSiteURL="https://crescent-admin.sharepoint.com"
$OneDriveSiteUrl="https://crescent-my.sharepoint.com/personal/biadmin_crescent_com"

#Get Credentials to connect to SharePoint Admin Center
$Cred = Get-Credential

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -credential $Cred

#Remove OneDrive Site Collection
Remove-SPOSite -identity $OneDriveSiteUrl
Write-Host "OneDrive site collection deleted successfully"
If you get “Remove-SPOSite : The requested operation is not supported for site: https://YourDomain-my.sharepoint.com/personal/UserID” Error, this means the OneDrive for Business site is under eDiscovery hold or retention policy that is blocking deletion.

Delete All OneDrive Site Collections using PowerShell

This time, let us delete all OneDrive sites:

$AdminSiteURL="https://crescent-admin.sharepoint.com"

#Get Credentials to connect to SharePoint Admin Center
$Cred = Get-Credential

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL -Credential $Cred

#Get all Personal Site collections
$OneDriveSites = Get-SPOSite -Template "SPSPERS" -Limit ALL -IncludePersonalSite $True

Foreach($Site in $OneDriveSites)
{
    #Remove OneDrive Site Collection
    Remove-SPOSite -identity $Site.URL -Confirm:$false
    Write-Host "OneDrive site collection deleted successfully "$Site.URL
}

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

One thought on “How to Delete a OneDrive for Business Site?

  • Is there any way to get a deleted page back? Or create a new personal sharepoint page?

    Reply

Leave a Reply

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