kwizcom banner advertisement

Get-Set OneDrive Site Collection Storage Quota Size using PowerShell

Get OneDrive Site collection Storage Quota Information:
To get the storage quota data for a particular OneDrive site, use this PowerShell cmdlet in SharePoint Online Management Shell
Get-SPOSite -Identity "https://crescent-my.sharepoint.com/personal/salaudeen_crescent_com"
This gets you the currently allocated storage quota data for a single site collection.

Get Storage Quota Details of All OneDrive Site collections
Use this script in SharePoint Online Management Shell.
$AdminSiteURL="https://crescent-admin.sharepoint.com"

#Get Credentials to connect to SharePoint Admin Center
$Cred = Get-Credential

#Connect to SharePoint Online Admin Center
Connect-SPOService -Url $AdminSiteURL –credential $Cred

#Get all Personal Site collections and export to a Text file
$OneDriveSites = Get-SPOSite -Template "SPSPERS#9" -Limit ALL -includepersonalsite $True

$Result=@() 
# Get storage quota of each site
Foreach($Site in $OneDriveSites)
{
    $Result += New-Object PSObject -property @{ 
    URL = $Site.URL
    Owner= $Site.Owner
    Size_inMB = $Site.StorageUsageCurrent
    StorageQuota_inGB = $Site.StorageQuota/1024
    }
}

$Result | Format-Table

#Export the data to CSV
$Result | Export-Csv "C:\Temp\OneDrive.csv" -NoTypeInformation
This script produces nice CSV report in below format and gives how much storage a OneDrive sites are consuming.
OneDrive Storage report using powershell

How to Set Storage Quota for OneDrive Site Collection?
By default, OneDrive site collections in Office 365 comes with 1TB storage quota. In some situations, you may want to either increase or decrease the storage allocation. Say, you want to increase storage quota for a particular OneDrive site collection to 2TB:
Set-SPOSite -Identity "https://crescent-my.sharepoint.com/personal/salaudeen_crescent_com" -StorageQuota 2097152 
set onedrive storage quota using powershell

Similarly, quota can also be reset to the specified OneDrive storage quota
Set-SPOSite -Identity "https://crescent-my.sharepoint.com/personal/salaudeen_crescent_com" -StorageQuotaReset

To set the default storage quota for OneDrive sites at Tenant level, use:
Set-SPOTenant -OneDriveStorageQuota 2097152
Get-Set OneDrive Site Collection Storage Quota Size using PowerShell Get-Set OneDrive Site Collection Storage Quota Size using PowerShell Reviewed by Salaudeen Rajack on December 26, 2017 Rating: 5

1 comment:

  1. Brilliant Job, Thanks so much – It worked!

    ReplyDelete

Please Login and comment to get your questions answered!

Powered by Blogger.