To check OneDrive retention in Microsoft 365, read the tenant's SharePoint settings and look at deletedUserPersonalSiteRetentionPeriodInDays, the days a deleted user's OneDrive is kept. It's 30 days unless someone changed it, and it can be set from 30 to 3650. The count starts when the user account is deleted; blocking sign-in or removing the licence doesn't start it.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of the retention days and default OneDrive storage, read through Microsoft Graph. |
| Admin centre | Reading the setting where it's changed, in the SharePoint admin centre. |
| Altivane | Recommended for recurring reviews, with the retention beside every sharing and OneDrive setting. |
Before you start
Use an account with the Global Reader or SharePoint Administrator role; either can read the settings. The PowerShell example requests SharePointTenantSettings.; your organisation may require administrator consent.
The setting is read live. Microsoft 365 retention policies, retention labels and eDiscovery holds take precedence over it, so a OneDrive can be kept longer or deleted sooner than the setting says. The examples read and export and change nothing.
Option 1
Check OneDrive retention with PowerShell
Install the modules once, then connect, read the settings and export the OneDrive values.
# Install once, if the modules are not already installed.
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Sites -Scope CurrentUser$ErrorActionPreference = 'Stop'
Connect-MgGraph -Scopes 'SharePointTenantSettings.Read.All' -NoWelcome
try {
$settings = Get-MgAdminSharepointSetting
$days = $settings.DeletedUserPersonalSiteRetentionPeriodInDays
if ($null -eq $days) {
Write-Output 'The OneDrive retention setting was not returned.'
} else {
[pscustomobject]@{
DeletedUserOneDriveRetentionDays = $days
DefaultOneDriveStorageMB = $settings.PersonalSiteDefaultStorageLimitInMb
} | Export-Csv -Path './onedrive-retention.csv' -NoTypeInformation -Encoding utf8
Write-Output "A deleted user's OneDrive is kept for $days days."
}
} finally {
Disconnect-MgGraph | Out-Null
}The CSV has 1 row: the days a deleted user's OneDrive is kept, and the storage each new OneDrive starts with, in MB. To add other settings, such as IsSiteCreationEnabled, add them to the row.
List OneDrives already past their retention
After the retention period a OneDrive moves to the Recycle Bin for 93 days. The SharePoint Online Management Shell lists them; replace contoso with your tenant's name, and in PowerShell 7 load the module with Import-Module Microsoft. first.
# Run in a new session, with the SharePoint Online Management Shell installed.
Connect-SPOService -Url 'https://contoso-admin.sharepoint.com'
Get-SPODeletedSite -Limit All -IncludeOnlyPersonalSite |
Sort-Object DaysRemaining | Select-Object Url, DeletionTime, DaysRemaining
Disconnect-SPOServiceOption 2
Check OneDrive retention in the admin centre
- Sign in to the SharePoint admin centre as a SharePoint Administrator.
- Go to Settings and select Retention.
- Read the number of days a deleted user's OneDrive is kept.
- Leave the page without selecting Save.
Microsoft says a new value applies to the next user deleted and to any user whose deletion is still in progress. This suits a quick check where the setting is changed. To keep a record from one month to the next, use PowerShell or a report.
Option 3 ยท Recommended for recurring reviews
Check OneDrive retention with Altivane
- Open Altivane and choose the tenant.
- Run the SharePoint Sharing report.
- Open the tenant's Excel workbook and find SharePoint Sharing Settings, and in its OneDrive rows read Keep a deleted user's OneDrive, in days, and Default OneDrive storage, in GB.
- Read SharePoint Settings to Review for the settings that aren't at the recommended value, with the reason.
Each setting's row says what it does: for the retention, how long a deleted user's files can be recovered or handed over. The same report can also list the sites and OneDrives that allow Anyone links, and the SharePoint guests.
Contact usCommon questions
When does the retention period start?
When the user account is deleted from Microsoft Entra ID, even though the deletion takes time to finish. Removing a licence or blocking sign-in doesn't start it. Microsoft says a OneDrive without a licence is archived on its 93rd unlicensed day, whatever the retention setting.
Who can get to a deleted user's files?
The user's manager is given access by default and receives an email, then a reminder 7 days before the OneDrive is deleted. With no manager set, a secondary owner set in the SharePoint admin centre gets them instead. If access delegation is turned off, or neither is set, no one is given access or sent the emails.
Can a deleted OneDrive be brought back after the retention period?
For 93 days more, yes: it sits in the Recycle Bin and a SharePoint Administrator can restore it with PowerShell. Microsoft says the Recycle Bin isn't indexed, so searches and eDiscovery holds don't find what's in it. To list what's there, see how to list deleted sites in SharePoint Online.
Microsoft references
Technical references checked on 7 November 2026. The example scripts have been reviewed and syntax checked; they have not been run against a live tenant.