• Uncategorized
  • 5

Updated 2018-07 – Migrate homefolders to OneDrive

(And updated again 2018-09-07 with new Add-OneDriveSecondaryAdmin.ps1 script)

Microsoft recently released GA-version of SharePoint Migration Tool (SMT) and the version is now 2.1.

I had to update the blog post that I did a while ago with the new version of SMT and try to simply explain how we can migrate from our homefolders (homedirectories) to OneDrive.

Let’s begin!


On the machine that will handle the migration – install the following:

Then create a TXT file with the UserPrincipalName attribute for the users you want to migrate. Change the Filtering or SearchBase value after your environment. Here I will use my “OneDrive for Business Users” Security Group.

This file will be used the the BulkEnqueueOneDriveSite.ps1 script.

Then we have a total of three PowerShell scripts what we need to use.
(Please read them and understand them!)

The first script makes a pre-provisioning for each user’s OneDrive. Microsoft does not allocate space for the user until you start OneDrive (via the web or the client installed on the computer), but with the help of the script, administrators can do this.

Run .\BulkEnqueueOneDriveSite.ps1 -SPOAdminUrl <URL to SharePoint Admin> -InputFilePath <Path to Users.txt>

Then you need to enter an Global or SharePoint Admin account and password.

SetOneDriveAdminPermission.ps1 OR Add-OneDriveSecondaryAdmin.ps1
The second script sets an optional Global Admin as an additional administrator for each user’s OneDrive. If we don’t, we cannot migrate from home directory to the user’s OneDrive using the SharePoint Migration Tool.

If we want to use my new updated script (Add-OneDriveSecondaryAdmin.ps1) we need to specify the Users.txt file with users UPN.

Please edit the script to fit your tenant!

The third script retrieves the OneDrive security group and its members, then sets the members’ home directories to “Read” instead of “Full Control” so no changes are made during the migration phase.

Change the script to fit your environment!

Instead of Set-OneDriveAdminPermission.ps1 you can use Add-OneDriveSecondaryAdmin.ps1

Migration Phase

Create a .CSV mapping file containing the path to the user’s home directory and URL to the user’s OneDrive. This is the only thing that needs to be changed. Note that no header should be included in the .CSV file.

Example of the mapping file:

Read more at Microsoft regarding format the CSV file: https://docs.microsoft.com/en-us/sharepointmigration/how-to-format-your-csv-file-for-data-content-migration

Script to create the .CSV mapping file.

Double check that the CSV file looks correct!
Try to take one of the user’s OneDrive URL and when logged in with the Global Admin/SharePoint Admin account specified in the second script, try to reach the user’s OneDrive. If this has been done and you can access the URL, then everything is set.

Start the SharePoint Migration Tool and make sure you use the latest version of the tool. At writing the version is

with your Global Admin account for the tenant.
Choose “JSON or CSV file for bulk migration

Locate the file created in the previous script. Then click Add and the tool will check the contents of the file. If there are any errors in the file, the tool will say which row that is wrong or if you don’t have permissions to users OneDrive (Error message: Task NO. #1, You are not SharePoint Online Admin User).

If everything is correct, you will proceed to the next step.

Click Migrate and wait until migration is complete.

You’re all DONE!

Don’t forget to remove your Global Admin account from everyone’s OneDrive, just edit Set-OneDriveAdminPermission.ps1 script and set the IsSiteCollectionAdmin to $false.

You may also like...

5 Responses

  1. Per says:

    Thanks for the article, been very helpful.
    I’m curious as to why you chose to not use PowerShell for the last part?

    I alos recieve an error when trying to run the GUI part, Invalid SharePoint Online list. I haven’t been able to find anything regarding this error.

    • thoor says:

      You’re welcome! I think the SharePoint Migration Tool is quite a good tool and you can do an incremental transfer also. Are you able to access the users OneDrive URL? Does the CSV file look correct?

  1. September 1, 2018

    […] UPDATED POST for migrating homefolders to OneDrive here: https://thoor.tech/2018/07/updated-2018-07-migrate-homefolders-to-onedrive/ […]

Leave a Reply to thoor Cancel reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: