none
Need to exclude Exchange 2016 server from scripting RRS feed

  • Question

  • Hi,

    I got awesome script to monitor exchange server's database health

    source:http://www.msexchange.org/articles-tutorials/exchange-server-2010/monitoring-operations/monitor-dag-database-failover.html

    I have edited <g class="gr_ gr_193 gr-alert gr_gramm gr_run_anim Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="193" id="193">script</g>, its working fine.

                     

    [Bool] $bolFailover=$False

    [String] $errMessage=$null

    $date = get-date

    $subject =  "Database Health Check !!!" + $date

    $errMessage+="## Checking if any Database is not mounted as per Activation Preference 1 ##"

    $errMessage+="`n`n"

    Get-MailboxDatabase | ForEach {

           $db=$_.Name

           $curServer=$_.Server.Name

           $ownServer=$_.ActivationPreference | ? {$_.Value -eq 1}



           # Compare the server where the DB is currently active to the server where it should be

           If ($curServer-ne $ownServer.Key.Name) {

                         $errMessage+="`n$db on $curServer should be on $($ownServer.Key)"

                  }



                  $bolFailover=$True

           }



    $errMessage+="`n`n"


    $errMessage+="## Checking if any Database or Content Index is not healthy ##"

    Get-MailboxDatabaseCopyStatus * | ForEach { 

           If ($_.Status -notmatch "Mounted" -and $_.Status -notmatch "Healthy" -or $_.ContentIndexState -notmatch "Healthy") {

                  $errMessage+="`n`n$($_.Name)  |  Status: $($_.Status)  |  CQL: $($_.CopyQueueLength)  |  RQL: $($_.ReplayQueueLength)  |  ContentIndex: $($_.ContentIndexState)"

                  $bolFailover=$True 

           } 





    If ($bolFailover) { 


           Send-MailMessage -From "" -To "" -Subject $subject -Body $errMessage -SMTPserver ""

    }

    However I would like to exclude Exchange 2016 databases from monitoring for a while.

    How would i do that ?

    Friday, August 5, 2016 10:37 AM

All replies

  • Hi

    You have a command that lists all - Get-MailboxDatabaseCopyStatus * , you can try change this to 1 server or Database. 


    Edward van Biljon - Exchange MVP

    Friday, August 5, 2016 4:45 PM
    Moderator
  • Hi,

    @Edward van Biljon
    @neonite2


    I am able to exclude single database or single server. But I would like to exclude a bunch of exchange 2016 servers from monitoring. Would it be possible to edit above script according to my requirement ?

    Wednesday, August 10, 2016 7:51 AM
  • Get-exchangeserver |?{$_.some excluding criteria} |get-mailboxdatabase |foreach { ...}
    Monday, August 22, 2016 1:52 PM