SOLVED

File share to OneDrive for Business File Migration?

%3CLINGO-SUB%20id%3D%22lingo-sub-44352%22%20slang%3D%22en-US%22%3EFile%20share%20to%20OneDrive%20for%20Business%20File%20Migration%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44352%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInteresting%20one%2C%20I'm%20looking%20to%20migrate%20file%20share%20data%20(home%20drives)%20to%20OneDrive%20for%20Business%20using%20PowerShell.%26nbsp%3B%20I've%20hit%26nbsp%3Ba%20bit%20of%20an%20issue%20with%20permissions%20on%20%22my%20sites%22.%26nbsp%3B%20For%20information%20I've%20created%20a%20new%20user%20for%20doing%20the%20data%20migration%2C%20this%20is%20a%20cloud%20only%20user%20that%20has%20Global%20access%20on%20the%20tenant.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThe%20PowerShell%20scripts%20run%20under%20this%20credential%20however%20the%20issue%20is%20it%20doesn't%20have%20access%20to%20the%20users%20my%20site%2C%20in%20a%20on-prem%20scenario%20I%20would%20add%20the%20admin%20account%20to%20the%20web%20application%20and%20life%20would%20be%20rosey.%26nbsp%3B%20I%20thought%20that%20I%20could%20add%20the%20admin%20account%20to%20the%20company-my.sharepoint.com%20site%20within%20the%20SPO%20admin%20console%20but%20this%20doesn't%20seem%20to%20have%20any%20affect%20on%20sites%20already%20created.%26nbsp%3B%20If%20I%20add%20the%26nbsp%3Bdata%20migration%20user%20to%20the%26nbsp%3Busers%20mysite%20as%20a%20site%20collection%20admin%20the%20import%20process%20runs%20perfectly.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20any%20thoughts%20how%20i%20can%20get%20around%20this%20issue%20without%20having%20to%20interact%20with%20the%20users%3F%26nbsp%3B%20Powershell%20to%20add%20the%20data%20migration%20user%20to%20the%20user%20my%20sites%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-44352%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFiles%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOneDrive%20for%20Business%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44493%22%20slang%3D%22en-US%22%3ERe%3A%20File%20share%20to%20OneDrive%20for%20Business%20File%20Migration%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44493%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2368%22%20target%3D%22_blank%22%3E%40Zoltan%20Bagyon%3C%2FA%3E%26nbsp%3BGenius!%20thanks%20for%20that.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-44381%22%20slang%3D%22en-US%22%3ERe%3A%20File%20share%20to%20OneDrive%20for%20Business%20File%20Migration%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-44381%22%20slang%3D%22en-US%22%3E%3CP%3EJust%20include%20the%20following%20before%2Fafter%20migrating%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ESet-SPOUser%20-Site%20%24onedrive%20-IsSiteCollectionAdmin%20%24true%20-LoginName%26nbsp%3Bmigration_admin%40yourtenant.com%0A%23%20...migration...%0ASet-SPOUser%20-Site%20%24onedrive%20-IsSiteCollectionAdmin%20%24false%20-LoginName%20migration_admin%40yourtenant.com%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3Ewhere%20%24onedrive%20contains%20the%20URL%20of%20the%20user's%20Onedrive%20actually%20being%20migrated%2C%20like%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%22%3CA%20href%3D%22https%3A%2F%2Fyourtenant-my.sharepoint.com%2Fpersonal%2Fusername_yourdomain_com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fyourtenant-my.sharepoint.com%2Fpersonal%2Fusername_yourdomain_com%2F%3C%2FA%3E%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EThis%20grants%20site%20collection%20admin%20rights%20to%26nbsp%3Bthe%20given%20users%20Onedrive%20for%20the%20technical%20user%20whose%20credentials%20are%20used%20for%20the%20migration%2C%20then%20remove%20it%20once%20you%20are%20done.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent 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 (Frequent 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.