OneDrive Usage Report With PowerShell

OneDrive usage report with PowerShell

Perhaps you’re planning for a OneDrive data migration, or you simply need to get an overview.

This article will show you how to use PowerShell to generate a usage report of all your OneDrive sites in Office 365.

As OneDrive data is hosted in SharePoint Online, you’ll need to install the SharePoint Online PowerShell module to get started:

Install-Module Microsoft.Online.SharePoint.PowerShell

With this module installed, the first step is to connect to the SharePoint Online instance of your tenant.

Replace the following URL with your tenant name:


Then use Connect-SPOService to connect, e.g., like this:

Connect-SPOService -Url

Finally, you can select a list of sites from SharePoint Online using the Get-SPOSite CmdLet.

Use the IncludePersonalSite to include OneDrive sites and filter the query to only list the OneDrive sites.

The final script to export all your OneDrive sites looks like this:

Connect-SPOService -Url
Write-Host "Getting OneDrive sites..."
$OneDrives = Get-SPOSite -IncludePersonalSite $True -Limit All -Filter "Url -like ''"
$Result = @()
ForEach ($OneDrive in $OneDrives) {
    $OneDrive = [PSCustomObject]@{
        Email       = $OneDrive.Owner
        URL         = $OneDrive.URL
        QuotaGB     = [Math]::Round($OneDrive.StorageQuota / 1024, 3) 
        UsedGB      = [Math]::Round($OneDrive.StorageUsageCurrent / 1024, 3)
        PercentUsed = [Math]::Round(($OneDrive.StorageUsageCurrent / $OneDrive.StorageQuota * 100), 3)
    $Result += $OneDrive
$Result | ft Email,URL,UsedGB,QuotaGB,PercentUsed -AutoSize

As the result is stored in a PowerShell object ($Result), you can easily export the result to a CSV file or use it for further automation:

PS C:\> $Result | Export-Csv c:\Temp\OneDriveStats.csv -NoTypeInformation
PS C:\> $Result | % { Write-Host OneDrive usage of $_.Email is $_.PercentUsed percent}
OneDrive usage of is 17 percent
OneDrive usage of is 49 percent
OneDrive usage of is 23 percent

Office 365 Administration – LIKE a BOSS!

If you find working with the many Office 365 web consoles less than optimal, you’re not alone.

Working as Microsoft consultants for two decades, we’ve heard so many admins complain about Office 365 administration being overly complex and lacking intuitive admin tools.

That’s why, some years ago, we came up with Easy365Manager.

Easy365Manager is a lightweight snap-in for Active Directory Users & Computers that will consolidate your AD and Office 365 administration.

As it’s a simple extension to AD Users & Computers, there is no change to your infrastructure, it runs on any PC or server with AD Users & Computers, and the installation can be done in a few minutes.

But really, the best way to illustrate the benefit of working with Easy365Manager is to look at a typical use case.

How to Retire a Hybrid User in 30 Seconds

Let’s assume a user is leaving your company. For many organizations, this procedure involves the several admin steps:

  • Disable the AD user account.
  • Convert the Office 365 mailbox to a shared mailbox.
  • Remove the user from the global address list.
  • Set up forwarding of emails to the manager (or replacement user).
  • Delegate access to the mailbox to the manager (or replacement user) without Outlook automapping.
  • Immediately synchronize changes to Office 365.
  • Finally, remove the Exchange Online license.

It is very cumbersome to cover these steps using the standard tools offered by Microsoft. You would need to start and log in to the following admin tools:

  • AD Users & Computers
  • Exchange Online Admin Center
  • Exchange on-premises admin center
  • Exchange Online PowerShell
  • Azure AD Connect PowerShell
  • Microsoft 365 Admin Center

With Easy365Manager, you can perform all of the above steps directly from AD user properties in less than 30 seconds:

If you like to work in the most efficient way possible, give Easy365Manager a try.

You can download the fully functional 30-day trial here.

Our support is free, fast, and friendly. Also, during the trial period.