logo
search
Others

How to Get OneDrive Folder Sizes Using PowerShell

Huda QurayshiHuda Qurayshi Sep 28, 2026 870 views

Question details

The user needs to calculate the size of a specific folder across multiple OneDrive user accounts using a PowerShell script.

How to Get OneDrive Folder Sizes Using PowerShell
Product
Microsoft OneDrive / PowerShell
Device & OS
not provided
Scenario
An administrator needs to track storage usage for a specific custom directory (e.g., 'K drive') that was distributed to every user's OneDrive account.
Observed behavior
Retrieving folder-specific storage metrics across an entire tenant is not a native graphical feature and requires a customized PowerShell script based on the specific tenant permissions and structure.
Before you start

Ensure you have Global Administrator or SharePoint Administrator privileges in your Microsoft 365 tenant, and verify that the SharePoint Online Management Shell is installed on your machine.

Solution 1Recommended

Consult the Microsoft PowerShell Community for a Custom Script

Since folder size calculation across multiple user accounts requires a script tailored to your specific organizational structure, requesting assistance from Microsoft's specialized community is the best approach.

Calculating the size of specific OneDrive folders for all users is a complex administrative task. It requires querying the Microsoft Graph API or using advanced SharePoint Online PowerShell cmdlets.

Because every Microsoft 365 tenant has a unique permission structure and routing, generic scripts often fail. The Microsoft PowerShell Community consists of experts who can generate and debug a script safely tailored to your exact environment.

1
Visit the PowerShell Community

Open your web browser and navigate to the official Microsoft Tech Community at https://techcommunity.microsoft.com/t5/powershell/ct-p/WindowsPowerShell.

2
Sign in to your account

Click the 'Sign In' button at the top right and log in using your Microsoft account or organizational credentials.

3
Create a detailed forum post

Start a new discussion. Clearly state that you need a script to iterate through all user OneDrive accounts and calculate the size of a specific folder (like 'K drive').

4
Provide your tenant context

Include details about your current administrative roles and whether you prefer using the PnP PowerShell module, native SharePoint Online Management Shell, or Microsoft Graph API.

Consult the Microsoft PowerShell Community for a Custom Script
Why a custom script is necessary: Built-in Microsoft 365 admin center reports only show total OneDrive usage per user, not the storage consumed by individual subfolders. A script is mandatory for granular folder-level reporting.
Free Microsoft Office alternative

Simplify Your Daily Work with WPS Office

While managing Microsoft 365 administrative tasks like OneDrive PowerShell scripting can be complex, your daily document processing shouldn't be. WPS Office is a free, lightweight, and user-friendly alternative to Microsoft Office that lets you effortlessly create, edit, and manage your documents.

  1. 1. Download the installer: Visit the official WPS Office website and download the free installation package for your operating system.
  2. 2. Install the software: Run the downloaded file and follow the quick on-screen instructions to complete the setup.
  3. 3. Open your files: Launch WPS Office and directly open your existing Microsoft Office documents without any conversion required.
Fully compatible with Microsoft Office formats, including .docx, .xlsx, and .pptx.Significantly lighter on system resources with blazing-fast startup speeds.Familiar user interface ensuring a seamless migration and zero learning curve.Built-in PDF editing tools combined with powerful Word, Excel, and PowerPoint alternatives.
microsoft office alternative - wps office

Frequently Asked Questions

Can I check a OneDrive folder size without using PowerShell?

Yes, on an individual basis. A user can sync their OneDrive to Windows File Explorer, right-click the specific folder, and select 'Properties' to view its size. However, to do this for hundreds of users simultaneously, an administrative script is required.

Does the Microsoft 365 Admin Center show individual folder sizes?

No. The M365 Admin Center Usage Reports only display the total storage consumed by a user's entire OneDrive account. It does not provide a breakdown of individual subfolders.

Which PowerShell module is best for managing OneDrive?

Historically, the SharePoint Online Management Shell was used. Today, administrators often prefer the PnP PowerShell module or the Microsoft Graph PowerShell SDK, as they offer more efficient ways to query storage metrics across user sites.