To find inactive OneDrive accounts in Microsoft 365, download the OneDrive usage report with Get-MgReportOneDriveUsageAccountDetail and keep the accounts whose Last Activity Date is old or blank. Only file activity in the OneDrive counts. The report lists only people with a valid OneDrive licence, and it names no one if your tenant conceals names in usage reports.
| Method | Best fit |
|---|---|
| PowerShell | A CSV of OneDrives with no file activity for a set number of days, longest idle first. |
| Admin centre | A one-off export of Microsoft's usage report, sorted by last activity in Excel. |
| Altivane | Recommended for regular reviews, with the days set once and each OneDrive's storage. |
Before you start
Use an account that can view usage reports, such as Reports Reader or SharePoint Administrator. The PowerShell example requests Reports.; your organisation may require administrator consent.
Know how fresh it is. Microsoft says usage reports typically become available within 24 to 72 hours, so the last few days can be missing. It takes at least 7 days for a deleted account to be marked as deleted, and deleted users stay in the reports for 180 days. The examples read and export; they change no OneDrive or account.
Option 1
Find inactive OneDrive accounts with PowerShell
Install the modules once, then connect and export the OneDrives idle for more than 90 days or with no activity date.
# Install once, if the modules are not already installed.
Install-Module Microsoft.Graph.Authentication, Microsoft.Graph.Reports -Scope CurrentUser$ErrorActionPreference = 'Stop'
$days = 90
$utc = [System.Globalization.DateTimeStyles]::AssumeUniversal -bor
[System.Globalization.DateTimeStyles]::AdjustToUniversal
$today = (Get-Date).ToUniversalTime().Date
Connect-MgGraph -Scopes 'Reports.Read.All' -NoWelcome
try {
$download = Join-Path $PWD 'onedrive-usage-download.csv'
Get-MgReportOneDriveUsageAccountDetail -Period D180 -OutFile $download
$accounts = @(Import-Csv -Path $download)
Remove-Item -Path $download
$report = @(foreach ($account in $accounts) {
if ($account.'Is Deleted' -eq 'True') { continue }
$idle = $null
if ($account.'Last Activity Date') {
$last = [datetime]::ParseExact($account.'Last Activity Date', 'yyyy-MM-dd',
[System.Globalization.CultureInfo]::InvariantCulture, $utc).ToUniversalTime()
$idle = [int]($today - $last.Date).TotalDays
}
if ($null -eq $idle -or $idle -gt $days) {
[pscustomobject]@{
Owner = $account.'Owner Display Name'
Account = $account.'Owner Principal Name'
LastActivity = $account.'Last Activity Date'
DaysIdle = $idle
StorageGB = [math]::Round([double]$account.'Storage Used (Byte)' / 1GB, 2)
Files = [int64]$account.'File Count'
}
}
})
if ($report.Count -eq 0) {
Write-Output "No OneDrive has been idle for more than $days days."
} else {
$order = @{
Expression = { if ($null -eq $_.DaysIdle) { [int]::MaxValue } else { $_.DaysIdle } }
Descending = $true
}
$report | Sort-Object $order |
Export-Csv -Path './inactive-onedrives.csv' -NoTypeInformation -Encoding utf8
Write-Output "$($report.Count) OneDrives are idle for more than $days days or have no date."
}
} finally {
Disconnect-MgGraph | Out-Null
}The CSV has 1 row for each OneDrive: those with no activity date first, then the longest idle, with storage in gigabytes and the file count. The script leaves out OneDrives marked deleted. Raise or lower $days to widen or narrow the list. Microsoft leaves the date blank when a OneDrive has no file activity, and the date is the latest activity whatever period you ask for.
Option 2
Review OneDrive activity in the admin centre
- Open the Microsoft 365 admin centre for the correct tenant.
- Go to Reports > Usage. If Reports is missing, select Show all first.
- Under Reports, select OneDrive, then the Usage tab.
- Select Choose columns to add Last activity date (UTC) to the table if it isn't shown.
- Select Export to download every user's usage as a CSV file, then sort it by Last activity date (UTC) in Excel.
This suits a one-off look, and it's the same report the script downloads. It doesn't suit a regular review: each export means sorting and counting the days manually again.
Option 3 ยท Recommended for regular reviews
Find inactive OneDrive accounts with Altivane
- Open Altivane and choose the tenant.
- Run the OneDrive report. It flags OneDrives not used or changed for longer than the Inactive sites setting, 90 days to start.
- Open the tenant's Excel workbook and find OneDrives Not Used Recently: each owner with Last Used, Days Unused and Storage (GB), the longest unused first.
- Read OneDrive Summary for the count, and OneDrive Accounts for every OneDrive's last use.
Where the tenant hides names in usage reports, the table needs Everything as the tenant's access, or Custom with SharePoint full control. With Reports or Manage, OneDrive Summary says Not known (names hidden in usage reports) and the table is left out. The report needs a tenant signed in with a certificate.
Contact usCommon questions
Why do the owner columns not name anyone?
Microsoft hides user, group and site names in usage reports by default, and the setting applies to Microsoft Graph too. A Global Administrator can show them in the Microsoft 365 admin centre under Settings > Org settings, the Services tab, Reports, by clearing Conceal user, group, and site names in all reports. Microsoft logs showing names in the Microsoft Purview audit log, so check your privacy rules first.
Does a person who works every day show as inactive?
They can. Last activity is the latest file activity in their OneDrive, so someone who keeps every file in team sites shows as idle. Read the date as the OneDrive being idle, not the person.
What about the accounts behind idle OneDrives?
An idle OneDrive often belongs to an account no one signs in to. To check those, see how to find inactive users in Microsoft Entra ID.
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.