How to check from PS if SharePoint Online 'site storage limit' is set to 'Automatic' or 'Manual'?

Oleg Tserkovnyuk 671 Reputation points
2022-11-02T15:10:04.877+00:00

Is there any way to check from PS if SharePoint Online 'site storage limit' is set to 'Automatic' or 'Manual'?
Could not find way to get this information.
I was thinking about one workaround, but it is ugly: try to change limit for any site, in case of success setting is set to 'Manual'.
256472-image.png

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yi Lu_MSFT 17,616 Reputation points
    2022-11-03T08:31:16.417+00:00

    Hi @Oleg Tserkovnyuk
    If you manage storage limits manually, you need to regularly monitor them to make sure they aren't affecting site performance. You could use the following powershell to get a report for the storage of all sites:

    #Connect to SharePoint admin center using an admin account  
    #Specify the URL to your SharePoint admin center site, e.g. https://contoso-admin.sharepoint.com  
      
    $url = 'https://contoso-admin.sharepoint.com'  
      
    #Specify a folder path to output the results into  
    $path = '.\'  
      
    #SMTP details  
    $Smtp = '<SmtpServer>'  
    $From = '<SenderEmailAddress>'    
    $To = '<RecipientEmailAddress>'  
    $Subject = 'Site Storage Warning'    
    $Body = 'Storage Usage Details'  
      
    if($url -eq '') {  
        $url = Read-Host -Prompt 'Enter the SharePoint admin center URL'  
    }  
      
    Connect-SPOService -Url $url  
      
    #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  
    $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  
      
    #Sending email with output file as attachment    
    Send-MailMessage -SmtpServer $Smtp -To $To -From $From -Subject $Subject -Attachments $fullpath -Body $Body -Priority high  
    

    For more information, you could refer to:
    https://learn.microsoft.com/en-us/sharepoint/manage-site-collection-storage-limits#monitor-site-storage-limits-by-using-powershell


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.