Increasing SharePoint Site Size via PowerShell

Today, I want to show you how you can increase SharePoint Online site storage limits (aka quotas) via PowerShell. I ran into an issue today where a client was unable to upload new files to a private Microsoft Teams Channel due to the channel reaching it’s quota limit within SharePoint and the new SharePoint Admin Center doesn’t allow for this to be performed via the GUI.

Determine if SharePoint Module is Installed

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version

Install or Update SharePoint Module

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force
Update-Module -Name Microsoft.Online.SharePoint.PowerShell

Connect to SharePoint Admin Center via PowerShell

Connect-SPOService -Url https://<TenantName>

Note: Update the URL to match your tenant name, you can retrieve this by opening the SharePoint admin center and copying the URL.

List all of the SharePoint Online Sites, Usage and Quotas in CSV

#Specify a folder path to output the results into
$path = 'c:\SPOSiteUsage_'

#Local variable to create and store output file  
$filename = (Get-Date -Format o | foreach {$_ -Replace ":", ""})+'.csv'  
$fullpath = $path+$filename

#Enumerating all sites and calculating storage usage  
$sites = Get-SPOSite -Limit all
$results = @()

foreach ($site in $sites) {
    $siteStorage = New-Object PSObject

    $percent = $site.StorageUsageCurrent / $site.StorageQuota * 100  
    $percentage = [math]::Round($percent,2)

    $siteStorage | Add-Member -MemberType NoteProperty -Name "Site Title" -Value $site.Title
    $siteStorage | Add-Member -MemberType NoteProperty -Name "Site Url" -Value $site.Url
    $siteStorage | Add-Member -MemberType NoteProperty -Name "Percentage Used" -Value $percentage
    $siteStorage | Add-Member -MemberType NoteProperty -Name "Storage Used (MB)" -Value $site.StorageUsageCurrent
    $siteStorage | Add-Member -MemberType NoteProperty -Name "Storage Quota (MB)" -Value $site.StorageQuota

    $results += $siteStorage
    $siteStorage = $null

$results | Export-Csv -Path $fullpath -NoTypeInformation

With the script ran, a .CSV will be at the root of the C Drive (or in the $Path variable that you specified), within the CSV you’ll see the SharePoint sites and usage and quotas assigned.

Set SPO Site to Specific Storage Quota in MB

Set-SPOSite -Identity "<Full URL gathered from CSV>" -StorageQuota 15000 -StorageQuotaWarningLevel 13500

Note: Make sure to update the URL from the CSV that you gathered earlier and set the quota fields to meet your specifications, the quotas are in MB.

Confirm Quota is set on Specific Site

Get-SPOSite -Identity "<Full URL
 of the specific site>" | select url,template,storagequota,storageusagecurrent

Note: You could also rerun the CSV generation to confirm the new quota setting.

Until next time!