How to Get OneDrive Folder Sizes Using PowerShell
Question details
The user needs to calculate the size of a specific folder across multiple OneDrive user accounts using a PowerShell script.

- 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.
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.
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.
Open your web browser and navigate to the official Microsoft Tech Community at https://techcommunity.microsoft.com/t5/powershell/ct-p/WindowsPowerShell.
Click the 'Sign In' button at the top right and log in using your Microsoft account or organizational credentials.
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').
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.

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. Download the installer: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install the software: Run the downloaded file and follow the quick on-screen instructions to complete the setup.
- 3. Open your files: Launch WPS Office and directly open your existing Microsoft Office documents without any conversion required.

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.




