These one liner PowerShell script might be useful to some IT Pro’s who just want to list all of the SharePoint 2013 or 2010 content databases and the site collections within them and the site collection size within your SharePoint farm:

Get-SPContentDatabase | %{Write-Output “`r`n——-$($_.Name)——-“;foreach($site in $_.Sites){$url=$site.url;$size=[System.Math]::Round([int]$site.Usage.Storage/1MB,2); Write-Output “$($url) ($($size)MB)”}}

If you want it output to a CSV file:

$all=”Content Database,Site URL,Size`r`n”;Get-SPContentDatabase | %{foreach($site in $_.Sites){$url=$site.url;$size=[System.Math]::Round([int]$site.Usage.Storage/1MB,2); $output=”$($_.Name),$($url),($($size)MB)`r`n”;$all+=$output}}; $all | out-file c:sites.csv -forceĀ  -Encoding default

Leave a Reply

Your email address will not be published. Required fields are marked *