Who's Online
1 visitors online now
0 guests, 1 bots, 0 members
Support my Sponsor
  • An error has occurred, which probably means the feed is down. Try again later.

SharePoint PowerShell to identify all OneDrive sites and migrate content to SharePoint sites

I wanted to perform migration of few of my users content to their respective OneDrive site. To do so, I used below PowerShell to identify URL of all users who already have a OneDrive sites and then used FileMigration wizard to import their content in the respective OneDrive Site.

$TenantUrl = Read-Host "https://tenantname-admin.sharepoint.com/"
$LogFile = [Environment]::GetFolderPath("Desktop") + "\OneDriveSites.log"
Connect-SPOService -Url $TenantUrl
Get-SPOSite -IncludePersonalSite $true -Limit all -Filter "Url -like '-my.sharepoint.com/personal/'" | Select -ExpandProperty Url | Out-File $LogFile -Force
Write-Host "Done! File saved as $($LogFile)."
Once you have the list of OneDrive path, go to SharePoint Admin center > Select Migration > File Share Migration > Download and install the migration agent.
Note : Note agent should be installed on a system which should have access to the files through network drive we want to migrate
Use the user which you wish to use for migration and then provide the FileSharePath at the bottom of the screen. You can test if you have access to the UNC path using test button.
Once everything is setup, you need can close this agent and let it run in the background. It will take sometime for the agent to appear in the SharePoint Admin center Agents screen

Select Add task from Migration screen
Select ‘Single source and destination’ and then select next
Put the path of the users folder and select next
Select OneDrive icon and select next
Select the OneDrive path URL and then select the Document library you want the files to be migrated. Then select Next
Prove the TaskName, Select the Active Agents and make sure you select Perform scan only and Preserve file share permissions as required. Select Next

Comments are closed.