This scripts allows to get the size for all the content databases available in a SharePoint Farm. The script defines a function (Get-ContentDBSizes) that gets all the Web Applications existing in a SharePoint Farm. For each Web Application, the function also gets the information of all the content databases available. For each content dabase, information about the parent Web Application, Content Dabase size (in GB) is written in CSV file.
Editar script|Remove
If ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )  
{ Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell } 
$host.Runspace.ThreadOptions = "ReuseThread" 
#Function that gets the size of all the content databases 
function Get-ContentDBSizes 
        $spWebApps = Get-SPWebApplication -IncludeCentralAdministration 
        foreach($spWebApp in $spWebApps)  
            $ContentDatabases = $spWebApp.ContentDatabases 
            foreach($ContentDatabase in $ContentDatabases)  
                $ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2) 
                $ContentDatabaseInfo$spWebApp.DisplayName + "," + $ContentDatabase.Name + "," + $ContentDatabaseSize + " GB"  
                #Write-Host " * "  $spWebApp.DisplayName "-" $ContentDatabase.Name ": " $ContentDatabaseSize " GB" 
    catch [System.Exception] 
        write-host -f red $_.Exception.ToString() 
Start-SPAssignment –Global 
Get-ContentDBSizes > ContentDBs.csv 
Stop-SPAssignment –Global 
Remove-PsSnapin Microsoft.SharePoint.PowerShell