Reporting OneDrive for Business Storage

Now Much Easier to Find OneDrive for Business Sites with PowerShell

A couple of years ago, retrieving information about OneDrive for Business sites with PowerShell usually involved some gyrations. Then Microsoft updated the Get-SPOSite cmdlet with the IncludePersonalSite switch and things became easier. For instance, a reader asked if it was possible to generate a report listing all the OneDrive for Business sites in a tenant with the storage allocated and used for each site. No problem, we thought, as we scanned the internet to see if people had already solved the problem. As it happens, several example scripts are available, but we ended up writing our own because it was possible to simplify the code . We also store the output in a CSV file as it’s a very flexible format for reporting or further analysis (like importing into Power BI).

PowerShell Report for OneDrive Storage

You need to import the SharePoint Online module to a PowerShell session and connect with an admin account. Once this is done, you can run this code.

Figure 1 shows an example of the CSV file generated by the code. Because the information is in a CSV file, you can sort and organize it in whatever way makes sense for you.

CSV file listing the storage consumed by OneDrive for Business sites
Figure 1: CSV file listing the storage consumed by OneDrive for Business sites

The public health warning is that we’ve not tested the script on very large tenants. It might take some time to run in those scenarios, in which case you could break up processing. For instance, you could filter for sites starting with each letter of the alphabet and then combine the results for each letter into a single file.


Need more information about managing OneDrive for Business? Because the same general approach can usually be taken for both SharePoint Online and OneDrive for Business, we cover that topic in the chapter that deals with SharePoint Online management in the Office 365 for IT Pros eBook.

Advertisements

One Reply to “Reporting OneDrive for Business Storage”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.