How to Move OneDrive Folders for Multiple Users via PowerShell Script
Question details
The user needs to move specific contents of a OneDrive folder, such as Personal Data to Documents, for over 100 users simultaneously using PowerShell automation.

- Product
- Microsoft OneDrive
- Device & OS
- not provided
- Scenario
- Performing a bulk migration or restructuring of user folders across an enterprise environment.
- Observed behavior
- Manual migration is unfeasible for 100+ users, requiring a secure, automated PowerShell script with proper permissions, logging, and duplicate handling.
Ensure you have Microsoft 365 SharePoint Administrator or Global Administrator privileges. Always back up user data and test the automation script on a small pilot group of 2-3 users before deploying it across the entire organization.
Develop and Test a Custom PnP PowerShell Script
Since Microsoft does not provide a native admin button for bulk granular file moves, you must use custom PowerShell scripts via PnP PowerShell or SharePoint Online Management Shell.
Moving files across multiple OneDrive accounts requires iterating through each user's personal site collection. Because environments vary heavily based on tenant configuration, there is no one-size-fits-all script.
It is highly recommended to seek guidance from the Microsoft PowerShell community or Q&A forums for tested script snippets tailored to your environment. You must define the tenant, user scope, source paths, destination paths, authentication method, and duplicate handling.
Identify the exact source folder paths and target folder paths. Create a CSV file containing the User Principal Names (UPNs) of the 100+ users involved in the migration.
Open PowerShell as Administrator and run 'Connect-PnPOnline -Url <AdminSiteUrl> -Interactive' or use App-Only authentication to connect to your Microsoft 365 tenant securely.
Write a script that imports your CSV file and uses a 'foreach' loop to iterate through each user's personal OneDrive URL. Use commands like 'Move-PnPFile' or 'Move-PnPFolder' to execute the transfer.
Add Try-Catch blocks to your script to capture errors, such as locked files or permission issues, and output them to a local log file for review.
Post your drafted script to the official Microsoft Learn Q&A forums (under the PowerShell tag) to get feedback from engineers and community members prior to execution.

Manage Your Documents Seamlessly with WPS Office
If you are looking for an easier way to manage enterprise documents without complex PowerShell administration, consider WPS Office. It provides an all-in-one suite with integrated cloud management that streamlines file sharing and collaboration.
- 1. Download and Install: Visit the official WPS Office website to download the free installer for your operating system.
- 2. Sign In to WPS Cloud: Create a free account or sign in to activate your built-in cloud storage.
- 3. Manage Files Easily: Use the WPS Cloud tab within the app to drag, drop, and reorganize folders without needing complex administrative scripts.

Frequently Asked Questions
Why isn't there a built-in Microsoft 365 admin tool to bulk move user folders?
The Microsoft 365 admin center is designed for global policy and access management rather than granular file-level movements across multiple personal user drives. Bulk folder restructuring requires interacting with the underlying SharePoint APIs, which is best achieved through PowerShell.
What permissions are required to run a OneDrive bulk move PowerShell script?
You need SharePoint Administrator or Global Administrator rights within your Microsoft 365 tenant. The script must also authenticate with sufficient privileges to access and modify the hidden personal site collections of individual users.
How do I prevent data loss when moving files via PowerShell?
To prevent data loss, ensure your script includes robust error handling and logging. Decide how the script will handle duplicate files (e.g., overwrite or skip), and always run a pilot test on 2-3 test accounts before deploying it to a larger group.




