Looking for a detailed guide to perform OneDrive tenant to tenant migration using PowerShell? If yes, then here it is. This article will cover the same user query along with the smart solution to perform this operation without any error.
OneDrive is the cloud storage service provided by Microsoft for its users. The major benefit of OneDrive is that it provides its employees with a secure location to store files and collaborate on papers that can be accessed from anywhere around the world.
Many people also use OneDrive to create documents inside their OneDrive area, upload documents and files and have many tools at their disposal to organize their own stuff.
When are users generally required to migrate their OneDrive from one tenant to another?
When an employee is leaving the organization, a copy of their OneDrive files is required or the files’ owner is to be transferred to someone else.
This task can be tedious, requiring you to log into the departing users’ OneDrive and download, transfer, or share their data manually.
However, you don’t have to fret so much as you can do this with PowerShell. Using this below script you can copy a user’s entire OneDrive directory into a subfolder in another user’s OneDrive.
But, every rose has thorns right?
The PowerShell method is also not devoid of flaws, which will be discussed later in this article. Therefore, a professional tool will also be discussed in this article, to provide you with an alternative.
What Are The Prerequisites For Migrating OneDrive From One Tenant To Another Using PowerShell?
To run this PowerShell script, you must first install the necessary PowerShell modules:
- SharePoint Online Administration Shell
To change the permissions on the users’ OneDrive site collections, utilize the SharePoint Online Management Shell.
The cmdlets we’ll use to move files and folders across OneDrive accounts are provided by the SharePoint PnP PowerShell module.
To install it, launch PowerShell as an administrator and execute the following cmdlet:
Install-Module SharePointPnPPowerShellOnline -Force |
For this script, you’ll also need the MSOnline V1 PowerShell Module.
To install it, launch PowerShell as an administrator and execute the following cmdlet:
Install-Module MSOnline -Force |
How to Migrate OneDrive Data from One Tenant to Another Using PowerShell
- Copy and paste the script at the bottom of this post into Visual Studio Code or PowerShell ISE.
- F5 will launch it.
- Follow the instructions and input the following information:
- The leaving user’s username. This is the user who’s OneDrive we will clone.
- The destination user’s username. This is the user who will get the files from OneDrive in a subfolder within their OneDrive.
- Your Office 365 Admin’s username.
- The script will look for files that are too big to transmit. If there are any, their information will be recorded in C:templargefiles.txt.
- Allow for the creation of folders and files. Folders are first established so that the Copy-PnPFile cmdlet may use an existing path to store the files.
- Once completed, the files and folders will be found in the destination user’s OneDrive in a subdirectory labeled “Departing User” files. Where Departing User is the display name of the departing user.
Limitations of PowerShell
- This might take some time.
- It takes at least a second or two to process each file or folder. If your leaving user has tens of thousands of files and time is of the essence, you may want to try a different technique.
- It takes advantage of your internet connection.
- It saves the files to the user’s OneDrive before uploading them to the other user’s OneDrive. If your internet connection is sluggish and you’re transferring huge files, you might want to leave this running on a cloud-hosted server.
- It cannot transfer files greater than 250MB.
- This PowerShell module has a restriction in that it cannot transfer files greater than 250MB to SharePoint. This script will detect these files and write a list of them to c:templargefiles.txt in case you want to move them manually.
- There is no two-factor authentication.
- This script is incompatible with multi-factor authentication on the admin account. You could wish to set up a temporary admin account without MFA for this reason.
Smart Approach to Perform OneDrive Tenant to Tenant Migration
Given all of these disadvantages, it is understandable that you would prefer not to use the aforementioned approach, which is why we will offer you an automatic OneDrive to OneDrive Migration Tool.
The tool makes transferring OneDrive files from one tenant to another a snap. This tool may transfer data from one tenant to another in bulk. It enables delta migration, which allows you to transfer freshly received objects. If you simply want to relocate a subset of your data, you may use the filter option. This program can quickly transfer all types of data, including documents, PDFs, and pictures.
Follow the below steps to understand the tool better:
Step 1: Install and run the program on your machine, then pick Office 365 as the source and destination.
Step 2: Select the document and activate the move document permissions checkbox. Filters can be used if necessary. Next, click the button.
Step 3: Log in to the source tenant using your admission id and application id, and then confirm your permissions. Click the Next button to perform OneDrive tenant to tenant migration.
Step 4: Finally, Begin the OneDrive-to-OneDrive company migration.
Conclusion
If you don’t know how to accomplish it, migrating your OneDrive data from one tenant to another will be a difficult process.
Microsoft provides a solution in the form of a PowerShell script, which is highly difficult and impossible for non-technical people to complete; thus, an automated tool is shared with you in this post.