# Original Script http://www.angryadmin.co.uk/ # Modification: Andy Grogan # Jan 2012 # This script does not belong to www.telnetport25.com # It is derived from works by the aforementioned author Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 $ComputerName = Get-Wmiobject Win32_ComputerSystem | Select Name $Status = Get-MailboxDatabaseCopyStatus -server $ComputerName.Name $flag = 0 foreach($State in $Status){ if(($state.status -match "Mounted") -or ($state.status -match "Healthy")){ $content = $($state.name)+": "+$($state.status) $output += $content+" - " }else{ $content = $($state.name)+": "+$($state.status) $output += $content+" - " $flag = 1 } } $output = $output.trimend(" - ") $output = $output.replace("\$ComputerName.Name","") write-host $output if($flag -eq 0){ exit 0 }else{ exit 2 }