I have uploaded a PowerShell Script on TechNet gallery, with that script you can get the site collection information which include Content DB details, count of current sub sites, and also size of each sub site, site collection and content DB. You can download and execute the script file using administrative rights on SharePoint Farm.
The output of file is saved in CSV format, which you can save it to any defined path.
The script contains 5 functions, the main function is GetGeneralInfo which generates all site information, it takes site URLS and output file path as parameter.
Function GetGeneralInfo($siteUrl, $OutputFile) { #Write CSV- TAB Separated File) Header "Name `t Value" | out-file $OutputFile $ContentDB = Get-SPContentDatabase -site $siteUrl $ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2) "Database Name `t $($ContentDB.Name)" | Out-File $OutputFile -Append "Database ID `t $($ContentDB.ID)" | Out-File $OutputFile -Append "Site count `t $($ContentDB.CurrentSiteCount)" | Out-File $OutputFile -Append "Site count `t $($ContentDB.MaximumSiteCount)" | Out-File $OutputFile -Append "Can Migrate `t $($ContentDB.CanMigrate)" | Out-File $OutputFile -Append "Content DB Size `t $($ContentDatabaseSize) GB" | Out-File $OutputFile -Append "Database Servername `t $($ContentDB.Server)" | Out-File $OutputFile -Append "Connection String `t $($ContentDB.DatabaseConnectionString)" | Out-File $OutputFile -Append "Display Name `t $($ContentDB.DisplayName)" | Out-File $OutputFile -Append "Schema `t $($ContentDB.SchemaVersionXml)" | Out-File $OutputFile -Append GetWebSizes -StartWeb $siteUrl }
The function call is quite simple as below:
GetGeneralInfo "http://spFarm" "C:\GeneralInfo.csv"
The basic detail of the site collection is fetched from Get-SPContentDatabase class, and sub site and site collection size is fetched from remaining functions which is calculated all files in the document libraries.
If you feel any difficulty on running this script then do update me.
This script has been tested on SharePoint 2010 and SharePoint 2013