Get-MailboxDatabase -Status | sort name | select name,@{Name='DB Size (Gb)';Expression={$_.DatabaseSize.ToGb()}},@{Name='Available New Mbx Space Gb)';Expression={$_.AvailableNewMailboxSpace.ToGb()}} | ft -auto
Database usage stats:
$dbs = Get-mailboxdatabase | select Name,Server | sort Name
$collcount = $dbs.count
$T1 = "Processing "
$T2 = " ("
$T3 = " of "
$T4 = ")"
$counter = 0
$results=@()
foreach($db in $databases){
$counter++
$Activity = $T1+$T2+$counter+$T3+$collcount+$T4
$percent = (($counter/$userscount) * 100)
$percentstatus = [String]([System.Math]::Round($percent, 0)) + "`% complete"
Write-Progress -PercentComplete $percent -Activity $activity -Status $percentstatus
$SUS = Get-StoreUsageStatistics -Database $db.name
$i = New-Object -TypeName PSObject
$i | Add-Member NoteProperty Database $db.name
$i | Add-Member NoteProperty Server $db.server
$i | Add-Member NoteProperty DisplayName $SUS.DisplayName
$i | Add-Member NoteProperty DigestCategory $SUS.DigestCategory
$i | Add-Member NoteProperty TimeInServer $SUS.TimeInServer
$i | Add-Member NoteProperty TimeInServer $SUS.TimeInCPU
$i | Add-Member NoteProperty SampleId $SUS.SampleId
$results += $i
}
$results | sort Server, TimeInServer -descending, Database | export-csv database-statistics.csv -notypeinformation