How to Delete OneDrive Data for Unlicensed Microsoft 365 Users
Question details
Administrators need a method to identify users who no longer have a Microsoft 365 license and efficiently delete their retained OneDrive data.

- 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.
Verify your organization's data retention policies and legal compliance requirements before permanently deleting any user data, as this action cannot be easily undone.
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.
Navigate to the official Microsoft documentation page for obtaining SharePoint and OneDrive URLs to understand the scripting requirements.
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.
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.
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.

Manually Access and Delete Unlicensed User Data
If you only need to clear the data of a few unlicensed users, you can manually generate an access link from the Microsoft 365 admin center and delete the files.
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. Download the Installer: Go to the official WPS Office website and download the free version suited for your operating system.
- 2. Install the Software: Run the setup file and follow the quick on-screen instructions to complete the installation.
- 3. Start Creating: Open WPS Office to immediately start viewing, editing, and saving your documents with full Microsoft format compatibility.

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.




