logo
search
OneDrive File Issues

How to Delete All Files from Users' OneDrive Accounts

Khadija KhanKhadija Khan Sep 25, 2026 870 views

Question details

Administrators need a reliable method to bulk delete all files and folders from multiple users' OneDrive accounts.

How to Delete All Files from Users' OneDrive Accounts
Product
Microsoft OneDrive, Power Automate
Device & OS
not provided
Scenario
Managing enterprise cloud storage and clearing user data across multiple accounts.
Observed behavior
Standard PowerShell scripts are proving unreliable for deleting all files and folders across multiple accounts, prompting the need for alternatives like Power Automate.
Before you start

Verify administrative permissions, check for legal holds or retention requirements, and ensure that backups exist or the data is no longer needed before performing bulk deletions.

Solution 1Recommended

Use Power Automate to Bulk Delete Files

Create a scheduled cloud flow to reliably iterate through users and delete files in their OneDrive accounts.

Since PowerShell scripts can sometimes run into reliability issues when handling massive bulk deletions across multiple users, a Power Automate flow provides a more robust, structured alternative.

1
Create a Scheduled Cloud Flow

Sign in to Power Automate and create a new Scheduled Cloud Flow to run at your desired time.

2
Retrieve Microsoft 365 Users

Add an action to retrieve the list of targeted users from your Microsoft 365 directory.

3
Iterate Through Users

Use an 'Apply to each' loop to iterate through the retrieved list of users.

4
List and Delete Files

Inside the loop, add an action to list files in the current user's OneDrive folder, and use a nested loop to delete each file. Ensure you add additional actions to process subfolders.

Use Power Automate to Bulk Delete Files
Subfolder Processing: You may need to implement recursive logic or additional steps in Power Automate to ensure files inside nested subfolders are also successfully retrieved and deleted.
Free Microsoft Office alternative

Manage Your Documents with WPS Office

While managing enterprise OneDrive accounts requires Microsoft 365 admin tools, WPS Office provides a lightweight, free alternative for individual and team document creation. Enjoy a familiar interface and seamless compatibility with all major office formats.

  1. 1. Visit the Official Website: Go to the official WPS Office website to find the appropriate download for your operating system.
  2. 2. Download the Installer: Click the 'Free Download' button to get the lightweight installation package.
  3. 3. Install and Use: Run the installer, set up your free account, and seamlessly open, edit, and save your Microsoft Office formatted documents.
Highly compatible with Microsoft Office formats (DOCX, XLSX, PPTX)Built-in WPS Cloud for easy and secure file storage and sharingLightweight installation that runs smoothly on all devicesFree to use for everyday office and document tasks
microsoft office alternative - wps office

Frequently Asked Questions

Is there an overwrite option when uploading local files to OneDrive?

Yes, when you upload files with the exact same name to the same location, OneDrive typically replaces the existing file with the new one and updates its version history.

Why did my PowerShell script fail to delete all OneDrive files?

PowerShell scripts for bulk operations can sometimes be unreliable due to API throttling, permission errors, timeout issues, or complex subfolder structures. Power Automate often provides a more reliable and structured alternative.

Should I use Microsoft Purview to delete user files immediately?

No, Microsoft Purview retention policies are designed for governed data management and automated lifecycle policies over time. They are not intended for immediate or ad-hoc bulk deletion tasks.