Many customers are making the move to the cloud, pushing up all traditional fileshares/homedrives to SharePoint and OneDrive. The purpose of this post is to lay out the steps for migrating individual users Home Drives to their personal Pnedrive in 365. We will be leveraging the free SharePoint Migration Tool from Microsoft.
Set Up the Destination Environment
CheckList:
Provision a Net New Tenant in Office 365
- They will be provisioned with the .onmcirosoft domain
- This can be purchased directly or under the CSP model through a distributor
In 365 Admin Center, Go to Setup>Domains>Add Domains
.
- Add the domain and verify with a TXT record
Add Users and Apply Licenses
- Add One at a time
- Bulk Upload via Powershell
- Bulk Upload Via CSV
- AD Connect Setup
- Ensure a license with OneDrive is added to the users
#Bulk Import Users with Passwords Powershell#
Pre-Provision OneDrive for Users
You will need to make sure all users have a personal OneDrive site created. By default, one is created when the user signs in. If this is a new deployment of office365 then you will need to run some scripts to pre-provision these sites
Sign-In to the SharePoint Admin Center
You can check to make sure a personal OneDrive is created for a user by signing into their tenant with global admin credentials and going to the SharePoint Admin Center
Grab Admin URL and Go to User Profiles
Take note of the admin url at the top of the page and click on the User Profiles button on the left **NOTE** If you do not see this page like this then click on Return to classic sharepoint center in the bottom left
Manage User Profiles
Select Manage User Profiles
Site Collection Owners
Search for any users and click the dropdown menu>Manage Site Collection owners
Site Creation
If the users has signed in then they will have had a personal site created and the following will pop up. *NOTE* Later in the setup, we will be adding a user for impersonation rights in the Site Collection Administrators section
No Site
If they have not signed in then most likely you will see the following
Download SharePoint Online Powershell
Next, we are going to run powershell commands to create the personal sites. If you’re pre-provisioning OneDrive for many users, create a list of these users and save it as a file. For example, create a text file named Users.txt that contains: user1@contoso.com user2@contoso.com user3@contoso.com. Download the SharePoint Online Shell Here
Run the following:
- Once Downloaded, run as Admin. Connect to your SharePoint tenant by entering the following. Note the URL is what you took note of in step b of this section:
$adminUPN=”<the full email address of a SharePoint administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>”
$userCredential = Get-Credential -UserName $adminUPN -Message “Type the password.”
Connect-SPOService -Url https://Orgname-admin.sharepoint.com -Credential $userCredential
Request-SPOPersonalSite
Run the PowerShell command Request-SPOPersonalSite. If you only have a few users you can run them one at a time. If you have many enter your txt file we created earlier
Gather List of URLs
- When the commands are done running, we can gather a list of all of our OneDrive urls. Run the following command and enter your admin URL again that we got in earlier steps
$TenantUrl = Read-Host “Enter the SharePoint Online Tenant Admin Url”
$LogFile = [Environment]::GetFolderPath(“Desktop”) + “\OneDriveSites.log”
Connect-SPOService -Url $TenantUrl
Get-SPOSite -IncludePersonalSite $true -Limit all -Filter “Url -like ‘-my.sharepoint.com/personal/” |select Url | Out-File $LogFile -Force
Write-Host “Done! File saved as $($LogFile).”
Add Impersonation Rights to all Sites
The SharePoint Migration tool will ask us to use an admin user to impersonate all URLs at the destination when we configure the migration job. We need to perform a script to get this done or do it manually if we do not have a lot of users.
You can go back to the same steps we performed in the previous section and add you admin user under the site adminstrators section in the SharePoint Admin Center. Again the path is User Profiles>Mange User Profiles>Manage Site Collection Owners. Perform for all users
Download the AdminRights.ps1 script and Modify the following:
Where the first two are you global admin creds, $spAdminUrl is your url from steps in the first section and $spMyURL can be found on the SharePoint admin center site collection page:
Run SharePoint Online Powershell as admin and run the following command: Set-ExecutionPolicy Unrestricted. Say yes to the commands. When finished, copy and paste your ps1 script you modify and run the command. It will run through and add the necessary permissions to all users
Create a CSV to Import
*NOTE* This section is only necessary if you have many users and do not want to enter each user one at a time
Format A CSV
- Create a CSV with 2 columns: Source and Target Web
- Paste the file paths of your HomeDrive users in the Source column and paste the OneDrive you gathered earlier in the Target Web column.
Download and Configure the SharePoint Migration Tool
Download on Server
We will want to download the tool on the sever where the HomeDrive is located. Here is the link for the tool. Agree and Install
Enter Global Admin Creds
After Installing the tool, sign-in with the global admin credentials that you gave impersonation rights to in the previous section
Start Config
Click start your first migration
Select Correct Option
If you only have a few users you are migrating and did not create a CSV, select File Share. If you created a CSV, click that section
If File Share Selected
If you have chosen file share, chose the file path of your user and then fill in their SharePoint URL
If CSV Selected
If you selected CSV you can upload it here
Review Migration
In either case, you will be able to start a batch migration
Configure Settings
You will have the option to configure many different settings, including the option to migrate data during a specific date range
Start the Job
When you are done configuring your settings, you can click migrate to start the job