check_mk-exchange-database-.../agents/plugins/sph-exchange-database-size.ps1

20 lines
791 B
PowerShell
Raw Normal View History

2014-12-23 11:17:10 +02:00
#[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
#write-output "" # workaround to prevent the byte order mark to be at the
# beginning of the first section
##############################################################################
# Exchange 2010 : mail database size
# Author: Marius Pana
# Company: Spearhead Systems
2014-12-30 13:09:33 +02:00
# Date 12/30/14
2014-12-23 11:17:10 +02:00
##############################################################################
add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010
2014-12-30 13:09:33 +02:00
$dbs = Get-MailboxDatabase -Status | ? {$_.Mounted -eq $True} | Sort Name
ForEach ($db in $dbs) {
$DBsize = $db.DatabaseSize.ToMB()
$DBfreeSpace = $db.AvailableNewMailboxSpace.ToMB()
Write-Host "<<<exchange_db_size>>>"
2014-12-30 13:09:33 +02:00
Write-Host "$($db.Name) $DBsize $DBfreeSpace"
}