if ( (Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction:SilentlyContinue) -eq $null) { Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 } $customer = "PuTYouRDataBaseNameHere" $maxDBsize = "15" $NagiosStatus = "0" $NagiosDescription = "" $db = Get-MailboxDatabase -Status $customer | select name $dbs = Get-MailboxDatabase -Status $customer | select Databasesize $DBsize = $dbs.DatabaseSize.ToGB() if ($dbsize -gt $maxDBsize) { if ($NagiosDescription -ne "") { # Format the output for Nagios $NagiosDescription = $NagiosDescription + ", " } $NagiosDescription = $NagiosDescription + $db.Name + " = " + $dbsize # Set the status to failed. $NagiosStatus = "2" } #end if if ($NagiosStatus -eq "2") { Write-Host ""$NagiosDescription" GB in use. Max. allowed is: "$maxdbsize" GB" } else { Write-Host "OK: Database $customername is not to large" } exit $NagiosStatus