Script to figure out site collections which are crossed storage quota

sns 9,226 Reputation points

Do we have script to pull the list of site collections which are crossed storage and giving a warning when browsing site.

Here I need list of those storage crossed/warning site collections from targeted set of site collections. Those targeted site collections number between 30 to 40.

Example : if I enter 30 site collections in input file and I should get list of those storage effected site collections in the output Please help.

Thank you.

SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,889 questions
0 comments No comments
{count} votes

Accepted answer
  1. Emily Du-MSFT 43,831 Reputation points Microsoft Vendor

    1.Go to Central Administration -> Application Management -> Configure quotas and locks -> Select the site collection -> Set the value of "Send warning e-mail when site storage reaches".
    2.Create an input csv file with site collection URLs.
    3.Run below PowerShell.

    if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)     
                        Add-PSSnapin "Microsoft.SharePoint.PowerShell"    
                    $results = @()    
                    $csv = Import-Csv "the local path of csv file, such as C:\sites.csv"  
                    $a = $csv.Url  
                      foreach ($_ in $a)    
                      $Site = Get-SPSite $_  
                                 $RowDetails = @{    
                                      "Site URL"                            = $site.Url    
                                      "Storage Used"                        = $site.Usage.Storage/1MB    
                                      "Storage Available Warning"           = $site.Quota.StorageWarningLevel/1MB    
                                      "Storage Available Maximum"           = $site.Quota.StorageMaximumLevel/1MB    
                          $results += New-Object PSObject -Property $RowDetails    
                       $e = $_.Exception    
                       $line = $_.InvocationInfo.ScriptLineNumber    
                       $msg = $e.Message     
                       Write-Host -ForegroundColor Red "caught exception: $e at $line"    
                       Write-Host $msg    
                       write-host "Something went wrong"    
                    $results | Export-csv -Path "C:\SiteQuotaDetailedInfo.csv" -NoTypeInformation    
                    Write-Host "-------------------- Completed! -----------------------------"  


    4.Compare "Storage Used" with "Storage Available Warning" in the output csv file.

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    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.

0 additional answers

Sort by: Most helpful