Find Correct OneDrive for Business URL for PnP PowerShell Migration
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.
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.
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.
Determine your Microsoft 365 tenant name. For OneDrive connections, append '-my' to the tenant name (e.g., https://companyname-my.sharepoint.com).
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.
Combine the subdomain and directory to form the complete OneDrive for Business URL: https://companyname-my.sharepoint.com/personal/name_surname_companyname.
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.
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. Download the Installer: Navigate to the official WPS Office website and download the free installation package for your operating system.
- 2. Install WPS Office: Run the setup file and follow the quick installation wizard to set up the lightweight productivity suite.
- 3. Open Your Documents: Launch WPS Office and directly open your existing Microsoft Office files without worrying about format conversion or data loss.

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.




