SharePoint Online Automation - Increase SharePoint Storage Quota In SharePoint Online Using PowerShell

In this article, we will learn how to increase SharePoint Storage Quota in SharePoint Online using PowerShell. In the last few of articles, I have demonstrated the below topics.

Kindly check the above articles to understand the requirement of businesses and how to solve the issue programmatically.

This demonstration will be applied to SharePoint Online, Office 365 Admin, and Office 365 Small Business Admin

As we know when a site collection is created in SharePoint online, we must specify a storage quota. This site size value must be between 100 MB and 100 GB. We will discuss more site collection quota and usage in the next upcoming article.

SharePoint online Site Collection Quota is allocated a quantity of storage that's based on your number of users. The storage is available to all site collections in the tenant and serves as a central pool from which everyone can draw. Site quota can be updated and modify as per requirement. If you are the Global admin for Office 365 tenant or Site collection administrator you will have access to do it.

Example: If you are managing a site collection, it will be easy to check site quota and increase the same, if working in the organization as SharePoint online Administrator where more than 1000+ site collection is exciting and on daily basis, we keep getting the request to update site collection quota. This is something where we need more attention and human effort to work on the same request.

Below are the steps to perform the above activity step by step with the screenshot,

Open PowerShell ISE with Admin rights and copy below script

As mentioned in the last articles, we always need to do changes of the defined variable as per your requirement. Here we need to update the below details.

  • $UserName = User Name of your Office 365 account – Line 7
  • $Password = Your Account password – Line 8
  • $Site URL - Site URL of Office 365 SharePoint Online where you increase site quota – Line 17
  • Read-Host "Enter the SharePoint Online Tenant" – Line 3
  • Tenant URL
  • $Quota=Read-Host "Enter the Storage Quota (1 GB) to be increased [in GB]: - Line 18

See below screenshot for more details

SharePoint

  1. Import - Module Microsoft.Online.SharePoint.Powershell  
  2. Write - Host "This script is to set Storage Quota" - f DarkGreen  
  3. Read - Host "Enter the SharePoint Online Tenant"  
  4. Write - Host "Connecting to SharePoint Online Tenant"  
  5. $UserName = "Your Account Name"  
  6. $Password = 'Password'  
  7. #Setup Credentials to connect  
  8. $Credentials = New - Object System.Management.Automation.PSCredential($UserName, (ConvertTo - SecureString $Password - AsPlainText - Force))  
  9. Connect - SPOService - Url "Office 365 Tenant" - Credential $Credentials  
  10. Write - Host "Your Tenant is connected"  
  11. $SiteUrl = Read - Host "Enter the site Collection URL to which you want to increase storage quota" [int] $Quota = Read - Host "Enter the Storage Quota (1 GB)to be increased [in GB]:"  
  12. $siteUrlDetail = Get - SPOSite $SiteUrl - Detailed - Limit all[int] $CurrentStorage = $siteUrlDetail.StorageQuota  
  13. if ($Quota - eq 5)  
  14. {  
  15.     Write - Host "Current Storage Quota is: $([MATH]::Round($CurrentStorage/1024,2)) GB" [int] $NewStorage = $Quota * 1024  
  16.     $StorageToIncrease = $CurrentStorage + $NewStorage  
  17.     Set - SPOSite - Identity $SiteUrl - StorageQuota $StorageToIncrease  
  18.     $NewSite = Get - SPOSite $SiteUrl - Detailed  
  19.     $NewQuota = [MATH]::Round($NewSite.StorageQuota / 1024, 2)  
  20.     Write - Host "New Storage Quota is : $NewQuota GB"  
  21. else   
  22. {  
  23.     Write - Host "You have entered the wrong value.As per Defined policy, Please enter 1 GB only for Sites" - f Red  
  24. }  
  • Once you have finished with changes or modification of defined variables, click on F5 and wait for below screen to come up asking you to enter Office 365 URL, see below screenshot,

    SharePoint
  • After the site is getting connected, it will prompt for Site collection where you want to increase site Quota.
  • Later this entry, PowerShell script will start action to check existing site quota and it will match with defined standard quota if Site quota is exceeded than standard limitation it will prompt to enter the site quota.

    SharePoint
  • Now, you can see, your site quota has been changed and it will show the current quota size of the site collection as well.

Up Next
    Ebook Download
    View all
    Learn
    View all