logo
search
OneDrive File Issues

How to Delete OneDrive Data for Unlicensed Microsoft 365 Users

Tauseeq MagsiTauseeq Magsi Sep 25, 2026 871 views

Question details

Administrators need a method to identify users who no longer have a Microsoft 365 license and efficiently delete their retained OneDrive data.

How to Delete OneDrive Data for Unlicensed Microsoft 365 Users
Product
Microsoft 365 / OneDrive
Device & OS
not provided
Scenario
Managing tenant storage limits and maintaining organizational compliance after removing user licenses, such as E3 or E5.
Observed behavior
OneDrive data is retained for a limited period after license removal, but there is no built-in feature in the admin center to immediately mass-delete data for all unlicensed users.
Before you start

Verify your organization's data retention policies and legal compliance requirements before permanently deleting any user data, as this action cannot be easily undone.

Solution 1Recommended

Use PowerShell to Identify and Manage OneDrive URLs

Since there is no built-in automated GUI feature, administrators must use SharePoint Online PowerShell to generate a list of OneDrive URLs and manage the storage.

Microsoft currently does not provide a direct button to wipe all unlicensed users' OneDrive data at once. You must first extract a complete list of OneDrive URLs for your organization and then run custom PowerShell commands to target the unlicensed accounts.

1
Review Microsoft Documentation

Navigate to the official Microsoft documentation page for obtaining SharePoint and OneDrive URLs to understand the scripting requirements.

2
Export OneDrive URLs

Use the SharePoint Online Management Shell to run the provided Microsoft PowerShell script, which exports a list of all user OneDrive URLs in your tenant to a CSV file.

3
Cross-Reference Accounts

Compare the exported list of URLs with your active users list in the Microsoft 365 Admin Center to isolate the accounts that no longer possess an active E3, E5, or equivalent license.

4
Seek Custom Scripting Support

Visit the Microsoft Q&A forum (OneDrive section) to find or request a specific PowerShell script from Microsoft engineers that can automate the deletion of the identified unlicensed storage arrays.

Use PowerShell to Identify and Manage OneDrive URLs
Community Support: Because tenant configurations vary, engaging with engineers on the Microsoft Q&A forum is the safest way to ensure your deletion scripts do not inadvertently affect licensed user data.
Free Microsoft Office alternative

Empower Your Team with WPS Office

While you manage complex administrative backend tasks like Microsoft 365 tenant storage, you can optimize your organization's software overhead with WPS Office. It is a powerful, free, and lightweight alternative for daily document creation and editing.

  1. 1. Download the Installer: Go to the official WPS Office website and download the free version suited for your operating system.
  2. 2. Install the Software: Run the setup file and follow the quick on-screen instructions to complete the installation.
  3. 3. Start Creating: Open WPS Office to immediately start viewing, editing, and saving your documents with full Microsoft format compatibility.
Fully compatible with Microsoft Word, Excel, and PowerPoint file formats (.docx, .xlsx, .pptx).Lightweight application that uses fewer system resources, ideal for diverse hardware setups.Familiar user interface that ensures a seamless transition for employees without extra training.Built-in PDF editing, document conversion, and collaboration tools.
microsoft office alternative - wps office

Frequently Asked Questions

How long is OneDrive data retained after removing a Microsoft 365 license?

By default, OneDrive data is retained for 30 days after a user account is deleted or a license is removed. However, administrators can configure this retention period to last anywhere up to 3650 days (10 years) in the SharePoint admin center.

Is there a button to delete all unlicensed OneDrive data automatically?

No, Microsoft currently does not provide a built-in automated GUI feature to instantly clear all OneDrive data for users without licenses. Administrators must rely on custom PowerShell scripts or manual deletion methods.

Where can I get help with PowerShell scripts for managing Microsoft 365 storage?

You can find extensive documentation on the Microsoft Learn portal. For highly specific tasks like targeting unlicensed users, posting your scenario in the OneDrive Microsoft Q&A forum is recommended to get assistance directly from Microsoft engineers.