Share via


SharePoint 2013: Content Databases and Site Collections sizes using PowerShell

Case

How to get the current sizes of content databases and site collections on the SharePoint farm using Powershell.

 

Code

Use below Power Shell script to produce the list of Content Databases with current size.

 

      Get-SPDatabase | Sort-Object disksizerequired -desc | format-table Name, @{Label =    "Size in MB"    ; Expression = {$_.disksizerequired/1024/1024}} | Out-File C:\CDBSize.csv -Encoding ascii   
   
      Use below Power Shell script to produce the list of site collections where size > 10GB from all the content databases.  
   
      Get-SPContentDatabase |Where { $_.Name -like      "WSS_Content_*"  } | Get-SPSite  -Limit  all  | Where {$_.Usage.Storage -gt 10000000000} | Select { $_.Url,$_.Usage.Storage} |Out-File D:\Logs\ULS\SCSize.csv -Encoding ascii