logo
search
Microsoft 365 Migration

Find Correct OneDrive for Business URL for PnP PowerShell Migration

Maira MehtabMaira Mehtab Sep 20, 2026 868 views

Question details

The user needs to locate the exact OneDrive for Business URL format to successfully migrate approximately 250 GB of personal documents to SharePoint using PnP PowerShell.

Product
OneDrive for Business, SharePoint, PnP PowerShell
Device & OS
not provided
Scenario
Migrating large volumes of personal user data from OneDrive for Business to a SharePoint site.
Observed behavior
PnP PowerShell connects to and displays the default SharePoint root files instead of the targeted user's personal OneDrive for Business documents.
Before you start

Verify that you have SharePoint Administrator or Global Administrator privileges in your Microsoft 365 tenant, and ensure you are using the latest version of the PnP.PowerShell module.

Solution 1Recommended

Use the Correct OneDrive for Business Personal Site URL

Reformat your connection string to target the user's specific personal site collection instead of the main SharePoint tenant.

By default, connecting to the root SharePoint URL will only expose standard site files. OneDrive for Business sites are hosted under a distinct '-my' subdomain and follow a specific personal folder naming convention based on the user's email address.

1
Identify the OneDrive Subdomain

Determine your Microsoft 365 tenant name. For OneDrive connections, append '-my' to the tenant name (e.g., https://companyname-my.sharepoint.com).

2
Format the User Directory

Append '/personal/' followed by the user's formatted email address where dots and at-symbols are replaced by underscores. The structure is typically: /personal/name_surname_companyname.

3
Construct the Full URL

Combine the subdomain and directory to form the complete OneDrive for Business URL: https://companyname-my.sharepoint.com/personal/name_surname_companyname.

4
Update PnP PowerShell Script

Replace the root SharePoint site URL (https://companyname.sharepoint.com/sites/sitename) in your Connect-PnPOnline command with the newly constructed OneDrive URL to target the correct 250 GB of data.

Need Further Assistance?: If you experience throttling or connection drops during the 250 GB migration, seek advanced help by posting in the PnP PowerShell GitHub issues repository or the Microsoft SharePoint Development community.
Free Microsoft Office alternative

Looking for a Lightweight Office Alternative?

While executing complex migrations and writing PowerShell scripts for Microsoft 365, you may want a faster, less resource-intensive productivity suite for your daily document editing. WPS Office offers a completely free, highly compatible alternative to Microsoft Office.

  1. 1. Download the Installer: Navigate to the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install WPS Office: Run the setup file and follow the quick installation wizard to set up the lightweight productivity suite.
  3. 3. Open Your Documents: Launch WPS Office and directly open your existing Microsoft Office files without worrying about format conversion or data loss.
Seamlessly open and edit Microsoft Word, Excel, and PowerPoint files (.docx, .xlsx, .pptx).Lightweight application that uses minimal system resources and starts up instantly.Familiar ribbon-style interface that requires zero learning curve.Integrated cloud storage for easily managing and sharing personal documents.
QA img-9

Frequently Asked Questions

Why does my PowerShell script show default SharePoint files instead of OneDrive documents?

This happens when the connection URL targets the root SharePoint tenant (e.g., companyname.sharepoint.com) rather than the specific personal site collection domain (companyname-my.sharepoint.com).

How is a user's email formatted in a OneDrive for Business URL?

Special characters like the at-symbol (@) and periods (.) in the user's UPN (User Principal Name) are typically converted to underscores (_). For instance, 'john.doe@company.com' becomes 'john_doe_company_com'.

Is PnP PowerShell capable of migrating 250 GB of data at once?

While PnP PowerShell can process large amounts of data, a 250 GB migration should ideally be batched. It is highly recommended to use the official SharePoint Migration API or split the transfer into smaller chunks to avoid Microsoft 365 throttling limits.