kwizcom banner advertisement

How to Delete OneDrive for Business Site Collection in SharePoint Online?

Requirement: Delete OneDrive for Business Site Collection! After a business decision made to disable OneDrive in organization wide, We configured the settings to disable OneDrive. However,  All existing OneDrive sites were active, users can 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 user account deleted from AD or when license is deactivated for the user in Office 365.

How to Delete OneDrive for Business Site Collection in SharePoint Online?
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 Remove-SPOSite cmdlet to delete any OneDrive for Business (My Site) site collection.

PowerShell to Delete a OneDrive for Business Site Collection
Use this PowerShell script on SharePoint Online Management Shell to remove a particular OneDrive site collection. Make sure you logged 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"

SharePoint Online: Delete All OneDrive Site Collections using PowerShell 
This time, lets 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#9" -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
}
How to Delete OneDrive for Business Site Collection in SharePoint Online? How to Delete OneDrive for Business Site Collection in SharePoint Online? Reviewed by Salaudeen Rajack on 5:27 PM Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.