SOLVED

File share to OneDrive for Business File Migration?

Iron Contributor

Hi

 

Interesting one, I'm looking to migrate file share data (home drives) to OneDrive for Business using PowerShell.  I've hit a bit of an issue with permissions on "my sites".  For information I've created a new user for doing the data migration, this is a cloud only user that has Global access on the tenant.


The PowerShell scripts run under this credential however the issue is it doesn't have access to the users my site, in a on-prem scenario I would add the admin account to the web application and life would be rosey.  I thought that I could add the admin account to the company-my.sharepoint.com site within the SPO admin console but this doesn't seem to have any affect on sites already created.  If I add the data migration user to the users mysite as a site collection admin the import process runs perfectly.

 

So any thoughts how i can get around this issue without having to interact with the users?  Powershell to add the data migration user to the user my sites?

2 Replies
best response confirmed by Rob Clarke (Iron Contributor)
Solution

Just include the following before/after migrating:

 

 

Set-SPOUser -Site $onedrive -IsSiteCollectionAdmin $true -LoginName migration_admin@yourtenant.com
# ...migration...
Set-SPOUser -Site $onedrive -IsSiteCollectionAdmin $false -LoginName migration_admin@yourtenant.com

 

where $onedrive contains the URL of the user's Onedrive actually being migrated, like:

"https://yourtenant-my.sharepoint.com/personal/username_yourdomain_com/"

 

This grants site collection admin rights to the given users Onedrive for the technical user whose credentials are used for the migration, then remove it once you are done.

@Zoltan Bagyon Genius! thanks for that. 

1 best response

Accepted Solutions
best response confirmed by Rob Clarke (Iron Contributor)
Solution

Just include the following before/after migrating:

 

 

Set-SPOUser -Site $onedrive -IsSiteCollectionAdmin $true -LoginName migration_admin@yourtenant.com
# ...migration...
Set-SPOUser -Site $onedrive -IsSiteCollectionAdmin $false -LoginName migration_admin@yourtenant.com

 

where $onedrive contains the URL of the user's Onedrive actually being migrated, like:

"https://yourtenant-my.sharepoint.com/personal/username_yourdomain_com/"

 

This grants site collection admin rights to the given users Onedrive for the technical user whose credentials are used for the migration, then remove it once you are done.

View solution in original post