OneDrive settings

How to check OneDrive retention in Microsoft 365

Read how long a deleted user's OneDrive is kept with Microsoft Graph PowerShell, check the Retention setting in the SharePoint admin centre, or run Altivane's SharePoint Sharing report.

By the Published

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.

Choose the method that fits the job
MethodBest fit
PowerShellA CSV of the retention days and default OneDrive storage, read through Microsoft Graph.
Admin centreReading the setting where it's changed, in the SharePoint admin centre.
AltivaneRecommended 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.Read.All; 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.

PowerShell
# Install once, if the modules are not already installed.
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Sites -Scope CurrentUser
PowerShell
$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.Online.SharePoint.PowerShell -UseWindowsPowerShell first.

PowerShell
# 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-SPOService

Option 2

Check OneDrive retention in the admin centre

  1. Sign in to the SharePoint admin centre as a SharePoint Administrator.
  2. Go to Settings and select Retention.
  3. Read the number of days a deleted user's OneDrive is kept.
  4. 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.

Common 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.

Talk to us about Altivane

Questions, or pricing? Get in touch.

Contact us