🎉 Our Microsoft 365 Reporting & Management Tool is now available in Azure Marketplace 🚀
This website uses cookies to improve your experience. We'll assume you're ok with this. Know more.
OneDrive

How to Get All OneDrive Sites for Business in Microsoft 365

OneDrive sites for Business play a crucial role in storing and sharing files across Microsoft 365. As organizations grow, challenges arise in locating and managing all OneDrive sites. Without clear visibility, unmanaged sites may lead to storage inefficiencies, security risks, and rising costs. This guide shows how to retrieve all OneDrive sites in Microsoft 365 to strengthen management, enforce oversight, and optimize resource usage across your environment.

List All OneDrive Site URLs Using Microsoft 365 Admin Center

Microsoft 365 Permission Required
Reports Reader Least Privilege
Global Admin Most Privilege
  • Log in to the Microsoft 365 admin center.
  • Navigate to Reports»UsageOneDrive»Usage.
  • Scroll down to the table below the usage charts.
  • To copy an individual user’s OneDrive URL, locate it in the URL column.
  • For easier access and filtering, you can export the full table as a CSV file by selecting Export in the upper-left corner of the report.
List All OneDrive Site URLs Using Microsoft 365 Admin Center

Note: If the site URL is missing in OneDrive usage report, you may need to be patient. Microsoft is aware of the issue and is working on a resolution. However, due to the operation’s complexity, they indicated that it may take a long time to fix.

List All OneDrive Sites in Microsoft 365 Using PowerShell

Microsoft 365 Permission Required
SharePoint Admin Least Privilege
Global Admin Most Privilege
  • Connect to SharePoint Online Management Shell using the cmdlet below.
  • Windows PowerShell Windows PowerShell
     Connect-SPOService -Url https://<TenantName>-admin.sharepoint.com
  • Run the following cmdlet to get all the OneDrive sites in your organization.
  • Windows PowerShell Windows PowerShell
     Get-SPOSite -IncludePersonalSite $true -Limit All -Template "SPSPERS" | FT 
List All OneDrive Sites in Microsoft 365 Using PowerShell

The above cmdlet retrieves the OneDrive site URLs for all users, along with the storage quota.

Export All OneDrive User Sites in Microsoft 365 Using PowerShell Script

Microsoft 365 Permission Required
SharePoint Admin Least Privilege
Global Admin Most Privilege
  • The above PowerShell cmdlet lists all OneDrive sites with limited detail. While you can extract more site information by applying additional filters, the process can become time-consuming in larger organizations.
  • To streamline this, we created a PowerShell script that retrieves a detailed report of OneDrive sites for all users with key information such as storage usage, quota, and more.
  • Download and run the following script in PowerShell to export all OneDrive URLs to a CSV file.
Export All OneDrive User Sites in Microsoft 365 Using PowerShell Script
GetOneDriveSiteURLs.ps1

Uncover Every Activity Across OneDrive Sites to Gain Complete Control!

AdminDroid’s OneDrive reporting tool offers comprehensive insights into all OneDrive sites for Business within Microsoft 365. It delivers detailed reports on usage, permissions, file access, and storage. These insights help you monitor OneDrive sites, identify potential risks, and ensure proper compliance.

Inspect OneDrive Site Components to Catch Suspicious Behavior

Monitor the OneDrive site statistics report to spot sudden spikes in file uploads or removals that may indicate insider threats or unauthorized activity.

Monitor Size Growth of Recently Created OneDrive Sites

Track all recently created OneDrive sites in your organization to find unauthorized site creations and ensure proper governance from day one.

Detect Inactive OneDrive Sites to Free Up Resources

Identify inactive OneDrive sites that are no longer in use, and manage them through archiving or removal to reclaim storage and optimize performance.

Analyze Large OneDrive Sites for Better Site Performance

Identify large OneDrive sites in Microsoft 365 and consider increasing their storage quota, if necessary, to support business-critical data.

Track OneDrive Sites Over Quota to Avoid Storage Disruptions

Spot OneDrive sites over their warning quota to address site storage issues early and avoid potential service disruptions.

Monitor OneDrive Sites Permission Assignments to Prevent Data Leaks

Use the OneDrive site permissions and sharing details report to identify unnecessary sharing permissions or unique role assignments and reinforce security policies to prevent data loss.

Overall, AdminDroid’s OneDrive for Business management tool provides seamless visibility into every OneDrive site across Microsoft 365. Beyond insights, it empowers you to manage site access, configure tenant settings, control sharing permissions, and streamline site content management. With everything centralized in one intuitive platform, you gain complete control and clarity over your OneDrive environment.

Explore a full range of reporting options

Important Tips

Restrict site-level sharing in OneDrive for confidential sites to control whom users can share data with and ensure files remain within approved boundaries.

Set up Microsoft 365 backup policies for OneDrive to ensure site recovery in case of accidental deletions or unauthorized changes.

Block uploading of specific file types in OneDrive sites to reduce the risk of malware and prevent potential threats from entering the organization.

Common Errors and Resolution Steps

The following are the possible errors and troubleshooting hints while identifying all OneDrive sites for Business in Microsoft 365.

Error ./GetOneDriveSiteUrls.ps1 cannot be loaded because it's not digitally signed.

This error occurs in PowerShell when your system’s execution policy restricts the execution of scripts that lack a digital signature.

Fix Run the following cmdlet to bypass the execution restriction in the current PowerShell session.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Error Get-PnPTenantSite: Unexpected response from the server. The content type of the response is "". The status code is "Unauthorized".

This error may occur when you try to run the Get-PnPTenantSite cmdlet without the required permissions.

Fix Grant the Sites.FullControl.All permission to the app, reconnect to SharePoint Online PowerShell using that app, and run the cmdlet again.

Error Connect-PnPOnline: Specified method is not supported.

This error occurs when you try to authenticate in PnP PowerShell without specifying the client ID and certificate.

Fix The PnP PowerShell module no longer supports interactive authentication using the multi-tenant PnP Management Shell app in Entra ID. Therefore, you should register an application in Entra ID and connect using the following cmdlet.
Connect-PnPOnline -Url "https://<tenant name>-admin.sharepoint.com" -ClientId "<app-id>" -Thumbprint "<cert-thumbprint>" -Tenant "<tenant name>.onmicrosoft.com"

Error Connect-PnPOnline: The term 'Connect-PnPOnline' is not recognized as the name of a cmdlet, function, script file, or operable program.

This error may occur if the PnP PowerShell module is not installed on your machine, or if you're using Windows PowerShell version earlier than 7.0, which does not support the module.

Fix Ensure you're using PowerShell version 7.0 or later, and then install the PnP PowerShell module using the following cmdlet.
Install-Module PnP.PowerShell -Scope CurrentUser -Force
Frequently Asked Questions

Discover All OneDrive Sites to Simplify Site Management and Improve Visibility in Microsoft 365

1. How to get all OneDrive site storage usage in Microsoft 365?

Each OneDrive site comes with a default storage quota of 1 TB. While some users barely use their allocated space, others may approach or exceed the limit. If storage usage goes unnoticed, it can lead to sync issues or even data loss. That’s why it’s essential to monitor OneDrive site storage reports regularly. This lets you proactively extend storage for users nearing their quota, reclaim unused space, and reassign licenses tied to inactive accounts.

Check storage usage of OneDrive sites in Microsoft 365

  • Go to the Active Users page in the Microsoft 365 admin center.
  • Select a user whose OneDrive storage you want to review.
  • In the user details pane, go to the OneDrive tab.
  • Here, you can view the user's current OneDrive storage usage.
check-onedrive-storage-usage-m365

View OneDrive site storage usage using PowerShell

Connect-PnPOnline -Url "https://<TenantName>-admin.sharepoint.com" -ClientId "<AppID>" -Thumbprint "<CertificateThumbprint>" -Tenant "<TenantName>.onmicrosoft.com"
  • Execute the cmdlet below to fetch the storage usage quotas of all OneDrive sites.
Get-PnPTenantSite -IncludeOneDriveSites -Filter "Url - like '*-my.sharepoint.com/personal/*'" |
ForEach-Object { Get-PnPTenantSite -Url $_.Url |
Select-Object Url, StorageUsageCurrent, StorageQuota }
view-onedrive-storage-usage-powershell

This cmdlet lists the current and allocated storage (in MB) for all OneDrive sites.

Get complete visibility into site storage across your tenant with AdminDroid’s all OneDrive site's usage summary report.

  • This report shows the storage usage of all OneDrive site collections with key details like storage used, quota assigned, site size, and more.
  • With these insights, you can instantly identify sites nearing their quota limits, spot underutilized storage, and allocate resources more effectively across all OneDrive sites.
onedrive-usage-summary-report

Handy Tip: Schedule the report periodically to stay updated on OneDrive site usage trends and make informed decisions on storage allocation.

2. How to find all OneDrive sites that were never used?

OneDrive sites linked to inactive or never-used accounts continue to consume storage and licenses. Identifying these unused sites helps you reclaim valuable storage, reassign licenses to active users. This streamlines resource management and keeps your Microsoft 365 environment efficient and cost-effective.

Identify unused OneDrive for Business sites in Microsoft 365

  • Connect to the SharePoint admin center using Connect-PnPOnline, then run the below cmdlet to find all empty OneDrive sites.
    Get-PnPTenantSite -IncludeOneDriveSites | 
    Where-Object {
     $_.Url -like "*-my.sharepoint.com/personal/*" -and $_.StorageUsageCurrent -eq 0 
    } |
    Select-Object Url, Owner, StorageUsageCurrent
identify-unused-onedrive-sites-m365

3. How to pre-provision OneDrive site for users in Microsoft 365?

In Microsoft 365, OneDrive sites are not created until users access them for the first time. This behavior can cause delays during SharePoint Server migrations when immediate access to cloud storage is required. To avoid such interruptions, admins can pre-provision OneDrive sites in advance so that users have instant access, content transfers can start right away, and the entire migration process remains smooth and uninterrupted.

Pre-provision OneDrive site for a specific user

Connect to the SharePoint Online Management Shell and execute the below cmdlet to pre-provision a OneDrive site for a Microsoft 365 user.

Request-SPOPersonalSite -UserEmails "<UserUPN>"

Pre-provision OneDrive for a multiple users in bulk

When onboarding a large number of users, pre-provisioning OneDrive sites one user at a time can be time-consuming. In such scenarios, you can provision OneDrive sites for multiple users at once.

  • Create a text file (e.g., Users.txt) with the email addresses of all users for whom you want to pre-provision OneDrive sites, as shown in the image below.
  • Run the following PowerShell cmdlet to pre-provision OneDrive sites for all listed users.
preprovision-onedrive-users-list
$users = Get-Content -Path "C:\Users.txt"
Request-SPOPersonalSite -UserEmails $users

Pre-provision Onedrive sites for all licensed users

When you want to provision OneDrive sites for all users, manually identifying those who don't have a site and provisioning them isn't practical in a large organization. To overcome this, you can pre-provision OneDrive sites for all licensed users in your organization at once to save time and effort.

Run the below cmdlet to pre-provision OneDrive for all licensed users in your organization.

Connect-MgGraph -Scopes "User.Read.All"
Connect-SPOService -Url "https://<TenantName>-admin.sharepoint.com"
$activeUsers = Get-MgUser -All -ConsistencyLevel eventual -CountVariable userCount -Filter "accountEnabled eq true" -Property AssignedLicenses,DisplayName,UserPrincipalName,Mail
$licensedUsers = $activeUsers | Where-Object { $_.AssignedLicenses.Count -gt 0 }
$list = @()
foreach ($u in $licensedUsers) {
	$list += $u.UserPrincipalName
	if ($list.Count -eq 199) {
		Request-SPOPersonalSite -UserEmails $list -NoWait
		$list = @()
	}
}
if ($list.Count -gt 0) {
	Request-SPOPersonalSite -UserEmails $list -NoWait
}

Note: The above snippet provisions OneDrive sites in batches of 199 users, as the 'Request-SPOPersonalSite' cmdlet can process up to 200 users at a time.

4. How to find all site collection admins across OneDrive sites for Business in Microsoft 365?

OneDrive allows users to share their sites with others to support collaboration. While this flexibility enhances productivity, it also introduces risks such as unauthorized changes, compliance violations, and inefficient access management. To mitigate these issues, it’s essential to regularly audit OneDrive site access granted to others. Identifying site collection administrators provides better visibility and helps ensure that elevated privileges remain in the right hands.

Identify all site collection admin across OneDrive sites

To find all site collection administrators across OneDrive for Business sites, use the following PowerShell script that relies on the PnP module. Since even Global admins can’t view site collection administrators unless they're explicitly added to each site, use a Microsoft Entra app with the 'Sites.Read.All' application permission to bypass this limitation.

$TenantName = "<TenantName>"; $ClientId   = "<ClientID>"
$Thumbprint = "<Thumbprint>"; $CsvPath    = "<CSV path>"
$AdminUrl   = "https://$TenantName-admin.sharepoint.com"; $TenantId   = "$TenantName.onmicrosoft.com"
Connect-PnPOnline -Tenant $TenantId -Url $AdminUrl -ClientId $ClientId -Thumbprint $Thumbprint
$oneDriveSites = Get-PnPTenantSite -IncludeOneDriveSites -Detailed | Where-Object {($_.Template -like "SPSPERS*")}
$adminOverview = @()
foreach ($site in $oneDriveSites) {
	Connect-PnPOnline -Url $site.Url -ClientId $ClientId -Thumbprint $Thumbprint -Tenant $TenantId
	$admins = Get-PnPSiteCollectionAdmin
	$ownerLogin = $site.Owner
	$ownerEmail = ($admins | Where-Object { $_.LoginName -eq $ownerLogin }).Email
	if (-not $ownerEmail) { $ownerEmail = $ownerLogin }
	$secondaryAdmins = $admins | Where-Object { $_.LoginName -ne $ownerLogin } | Select-Object -ExpandProperty Email
	$secondaryList = ($secondaryAdmins | Where-Object { $_ }) -join ";"
	$adminOverview += [PSCustomObject]@{
		"Name" = $site.Title
		"OneDriveURL" = $site.Url
		"PrimaryAdmin" = $ownerEmail
		"SecondaryAdmins" = $secondaryList
	}
}
$adminOverview | Export-Csv -Path $CsvPath -NoTypeInformation
find-onedrive-site-collection-admins-powershell-m365

Note: Primary admin refers to the main owner of the OneDrive site, while secondary admins are additional users with administrative access to the same site.

Stay ahead of every change in OneDrive with AdminDroid's default alert policies!

  • The OneDrive site collection admin added alert policy notifies you whenever an elevated access is granted to a user's OneDrive site.
  • With this alert policy, you can stay proactive and take swift action to manage unauthorized admin assignments.
  • To deploy the alert policy, click Preview & Deploy, define the filters and alert settings as needed, then click Deploy Alert Policy.
onedrive-site-collection-admin-added-alert

Kickstart Your Journey With
AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities

Download Now
User Help Manuals Compliance Docs
x
Delivering Reports on Time
Want a desired Microsoft 365 reports every Monday morning? Ensure automated report distribution and timely delivery with AdminDroid's Scheduling to your email anytime you need.
Delivering Reports on Time
Schedule tailored reports to execute automatically at the time you set and deliver straight to the emails you choose. In addition, you can customize report columns and add inteligent filtering to the activities just from the previous day to suit your Microsoft 365 report requirements.
Set It, Schedule It, See Results- Your Reports, Your Way, On Your Time!
Time Saving
Automation
Customization
Intelligent Filtering
Give Just the Right Access to the Right People
Grant fine-tuned access to any Microsoft 365 user with AdminDroid’s Granular Delegation and meet your organization’s security and compliance requirements.
Give Just the Right Access to the Right People
Create custom roles loaded with just the right permissions and give access to admins or normal users within AdminDroid. The result? A streamlined Microsoft 365 management experience that aligns your organization's security protocols and saves your invaluable time and effort.
Align, Define, Simplify: AdminDroid's Granular Delegation
Smart Organizational Control
Effortless M365 Management
Simplified Access
Advanced Alerts at a Glance
Receive quick notifications for malicious Microsoft 365 activities. Engage with the AdminDroid’s real-time alert policies crafted to streamline your security investigations.
Advanced Alerts at a Glance
Stay informed of critical activities like suspicious emails and high-risk logins, bulk file sharing, etc. Through creating and validating ideal alert policies, AdminDroid provides a comprehensive approach to real-time monitoring and management of potential threats within your organization.
AdminDroid Keeps You Always Vigilant, Never Vulnerable!
Proactive Protection
Real-time Monitoring
Security Intelligence
Threat Detection
Merge the Required Data to One Place
Combine multiple required columns into one comprehensive report and prioritize the information that matters most to you with AdminDroid’s Advanced Column Customization.
Merge the Required Data to One Place
This column merging capability offers a flexible way to add different columns from various reports and collate all the essential data in one place. Want to revisit the customized report? Save it as a 'View’, and your unique report is ready whenever you need it.
Merge with Ease and Save as Views!
Custom Reporting
Unique View
Desired Columns
Easy Data Interpretation
Insightful Charts and Exclusive Dashboards
Get a quick and easy overview of your tenant's activity, identify potential problems, and take action to protect your data with AdminDroid’s Charts and Dashboards.
Insightful Charts and Exclusive Dashboards
With AdminDroid charts and dashboards, visualize your Microsoft 365 tenant in ways you've never thought possible. It's not just about viewing; it's about understanding, controlling, and transforming your Microsoft 365 environment.
Explore Your Microsoft 365 Tenant in a Whole New Way!
Executive overviews
Interactive insights
Decision-making
Data Visualization
Efficient Report Exporting for Microsoft 365
Downloading your reports in the right file format shouldn’t be a hassle with AdminDroid’s Report Export. Experience seamless report exporting in various formats that cater to your needs.
Efficient Report Exporting for Microsoft 365
Navigate through diverse options and export Microsoft 365 reports flawlessly in your desired file format. Tailor your reports precisely as you need them and save them directly to your computer.
Take Control, Customize and Deliver- Your Office 365 Data, Exported in Your Way!
Easy Export
Seamless Downloading
Data Control
Manage Microsoft 365

Get AdminDroid Office 365 Reporter Now!