locked
Exchange 2007 Cluster Report RRS feed

  • Question

  • Hi Team

    am  Looking for the exchange 2007 Cluster Report something like below. We have Exchange 2007 CCR  environment, which i need to monitor the nodes via Script and the out put should send an HTML Email if any of the server are moved from active to native (Like Node1 to Node2)

    Exchange Cluster Report 1/1/2016 2:00:00 AM

    Cluster Server                 Cluster Active Node              Cluster Passive Node
    MbxClustername                 Node 2                                  Node1


    Could you please provide some scripts to check / monitor the CCR cluster  .  Please see below sample

    Thursday, August 25, 2016 11:43 AM

Answers

  • Hi Allen and Ed and Everyone,

    I managed to get the script done and able to receive the emails for Ex2007 cluster node active status report. hope this will help for some one.

    ===================================================================

    #Powershell script to pull Exchange Cluster Node status

    $STR += '<!-- saved from url=(0014)about:internet --><html><head><title> Output Generated on: ' + $(get-date).ToString() + '</title><style TYPE="text/css">'
    $STR += '<style>'
    $STR += '<!-- '
    $STR += 'body { font: Tahoma } '
    $STR += 'table { font: 10pt Tahoma; border: 0px} '
    $STR += 'td { border: 1px solid black; padding-left: 1px; padding-right: 1px } '
    $STR += 'p.header { font: 12pt Helvetica; color: DarkBlue }'
    $STR += 'p.normal { font: 10pt Tahoma; }'
    $STR += '-->'
    $STR += '</style>'
    $STR += '</head>'
    $STR += '<body>'
    $STR += "<p class=`"header`" align='center'><strong>MRC Exchange Cluster Report " + $(get-date).ToString()
    $STR += '<table width=auto align=center>'
    $STR += '<tr>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Server</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Active Node</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Passive Node</b></p></td>'
    $STR += '</tr>'

    $entries=Get-ExchangeServer | where {$_.ismailboxserver -eq $true} |sort-object -property:identity| foreach { 
     Get-ClusteredMailboxServerStatus -identity $_.name  |select identity,operationalmachines }

    foreach($entry in $entries)
    {

    #$str1=$entry.operationalmachines[0].tostring() 
    #$str2=$entry.operationalmachines[1].tostring()
    if ($entry.operationalmachines[0] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = "Node Paused"

       }

    if ($entry.operationalmachines[1] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[1].tostring()
         $str2 = "Node Paused"

       }


    if ($str1 -like "*Active*")
      { 
       $Anode=$str1
       $Pnode=$str2
      }
    else

    {
       $Anode=$str2
       $Pnode=$str1

    }
    $Anode =$anode.Replace("<","&lt;")
    $Anode =$anode.Replace(">","&gt;")
    $STR += '<tr>'
    $STR += '<td align="Center">' + $entry.identity + "</td>"
    if($anode -like "*hil*")
    {
    $STR += '<td align="center" style="background-color: cyan">'+  $Anode +"</td>"
    }
    else
    {
    $STR += '<td align="center" style="background-color: yellow">'+  $Anode +"</td>"
    }
    $STR += '<td align="center">' + $PNode + "</td>"
    $STR += '</tr>'
    }

    $STR += '</p></body></html>'
    $d = get-date
    $name= 'Cluster-ActiveNode'
    $name+= '.html'
    set-content $name -value $str

    Write-Host " Email Sending"


    $smtpServer = "HUBSERVER"
    $smtpFrom = "From Address"
    $smtpTo = "TO ADDRESS"
    $messageSubject = "Cluster Report"
    $message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
    $message.Subject = $messageSubject
    $message.IsBodyHTML = $true
    $message.Body = get-content "SPECIFY THE PATH OF HTML"
    $smtp = New-Object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($message)

    =====================================================================

    • Proposed as answer by Allen_WangJF Saturday, August 27, 2016 1:48 PM
    • Marked as answer by rush2ramki Monday, September 5, 2016 8:38 AM
    Saturday, August 27, 2016 4:00 AM

All replies

  • So you're asking someone to write a script for you?  Sorry, but I don't have the time to do that.  You're welcome to search the Internet to see if someone has already done that and has posted a sample.

    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!

    Thursday, August 25, 2016 5:09 PM
  • Thanks ED

    Somewhat i managed to get the script below

    ====================================

    Powershell script to pull Exchange Cluster Node status
    #Exchange 2007 Only.

    $STR += '<!-- saved from url=(0014)about:internet --><html><head><title> Output Generated on: ' + $(get-date).ToString() + '</title><style TYPE="text/css">'
    $STR += '<style>'
    $STR += '<!-- '
    $STR += 'body { font: Tahoma } '
    $STR += 'table { font: 10pt Tahoma; border: 0px} '
    $STR += 'td { border: 1px solid black; padding-left: 1px; padding-right: 1px } '
    $STR += 'p.header { font: 12pt Helvetica; color: DarkBlue }'
    $STR += 'p.normal { font: 10pt Tahoma; }'
    $STR += '-->'
    $STR += '</style>'
    $STR += '</head>'
    $STR += '<body>'
    $STR += "<p class=`"header`" align='center'><strong>ABC Exchange Cluster Report " + $(get-date).ToString()
    $STR += '<table width=auto align=center>'
    $STR += '<tr>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Server</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Active Node</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Passive Node</b></p></td>'
    $STR += '</tr>'

    $entries=Get-ExchangeServer | where {$_.ismailboxserver -eq $true} |sort-object -property:identity| foreach { 
     Get-ClusteredMailboxServerStatus -identity $_.name  |select identity,operationalmachines }

    foreach($entry in $entries)
    {

    #$str1=$entry.operationalmachines[0].tostring() 
    #$str2=$entry.operationalmachines[1].tostring()
    if ($entry.operationalmachines[0] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = "Node Paused"

       }

    if ($entry.operationalmachines[1] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[1].tostring()
         $str2 = "Node Paused"

       }


    if ($str1 -like "*Active*")
      { 
       $Anode=$str1
       $Pnode=$str2
      }
    else

    {
       $Anode=$str2
       $Pnode=$str1

    }
    $Anode =$anode.Replace("<","&lt;")
    $Anode =$anode.Replace(">","&gt;")
    $STR += '<tr>'
    $STR += '<td align="Center">' + $entry.identity + "</td>"
    if($anode -like "*hil*")
    {
    $STR += '<td align="center" style="background-color: cyan">'+  $Anode +"</td>"
    }
    else
    {
    $STR += '<td align="center" style="background-color: yellow">'+  $Anode +"</td>"
    }
    $STR += '<td align="center">' + $PNode + "</td>"
    $STR += '</tr>'
    }

    $STR += '</p></body></html>'
    $d = get-date
    $name= 'Cluster-ActiveNode'
    $name+= '.html'
    set-content $name -value $str
    ====================================================================

    It gives an HTML output . which i would like to send an email in the body . also, i would like to get the email alert, only the Active and qurom owner moved from Node 1 to Node 2. is that possible in E2K7


    • Edited by rush2ramki Friday, August 26, 2016 5:27 AM
    Friday, August 26, 2016 5:25 AM
  • Hi,

    Sorry, I don't find an any similar script to achieve your expectation. I recommend contact Exchange Development Team so that you can get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. For your convenience:
    https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting

    Furthermore, I find some scripts to monitor Exchange server, for your reference:
    Monitor and alert CCR storage group copy failures
    Generate Exchange Environment Reports using Powershell

    Also, you can search scripts with keywords in Script Center:
    https://gallery.technet.microsoft.com/office/site/search?f%5B0%5D.Type=RootCategory&f%5B0%5D.Value=Exchange

    Hope it helped.


    Allen Wang
    TechNet Community Support


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Friday, August 26, 2016 12:56 PM
  • Hi Allen and Ed and Everyone,

    I managed to get the script done and able to receive the emails for Ex2007 cluster node active status report. hope this will help for some one.

    ===================================================================

    #Powershell script to pull Exchange Cluster Node status

    $STR += '<!-- saved from url=(0014)about:internet --><html><head><title> Output Generated on: ' + $(get-date).ToString() + '</title><style TYPE="text/css">'
    $STR += '<style>'
    $STR += '<!-- '
    $STR += 'body { font: Tahoma } '
    $STR += 'table { font: 10pt Tahoma; border: 0px} '
    $STR += 'td { border: 1px solid black; padding-left: 1px; padding-right: 1px } '
    $STR += 'p.header { font: 12pt Helvetica; color: DarkBlue }'
    $STR += 'p.normal { font: 10pt Tahoma; }'
    $STR += '-->'
    $STR += '</style>'
    $STR += '</head>'
    $STR += '<body>'
    $STR += "<p class=`"header`" align='center'><strong>MRC Exchange Cluster Report " + $(get-date).ToString()
    $STR += '<table width=auto align=center>'
    $STR += '<tr>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Server</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Active Node</b></p></td>'
    $STR += '<td align="Left" style="background-color: darkblue"><p class="table" style="color: white"><b>Cluster Passive Node</b></p></td>'
    $STR += '</tr>'

    $entries=Get-ExchangeServer | where {$_.ismailboxserver -eq $true} |sort-object -property:identity| foreach { 
     Get-ClusteredMailboxServerStatus -identity $_.name  |select identity,operationalmachines }

    foreach($entry in $entries)
    {

    #$str1=$entry.operationalmachines[0].tostring() 
    #$str2=$entry.operationalmachines[1].tostring()
    if ($entry.operationalmachines[0] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = "Node Paused"

       }

    if ($entry.operationalmachines[1] -ne $Null )

       {
         $str1 = $entry.operationalmachines[0].tostring()
         $str2 = $entry.operationalmachines[1].tostring()
       }
    Else
       {
         $str1 = $entry.operationalmachines[1].tostring()
         $str2 = "Node Paused"

       }


    if ($str1 -like "*Active*")
      { 
       $Anode=$str1
       $Pnode=$str2
      }
    else

    {
       $Anode=$str2
       $Pnode=$str1

    }
    $Anode =$anode.Replace("<","&lt;")
    $Anode =$anode.Replace(">","&gt;")
    $STR += '<tr>'
    $STR += '<td align="Center">' + $entry.identity + "</td>"
    if($anode -like "*hil*")
    {
    $STR += '<td align="center" style="background-color: cyan">'+  $Anode +"</td>"
    }
    else
    {
    $STR += '<td align="center" style="background-color: yellow">'+  $Anode +"</td>"
    }
    $STR += '<td align="center">' + $PNode + "</td>"
    $STR += '</tr>'
    }

    $STR += '</p></body></html>'
    $d = get-date
    $name= 'Cluster-ActiveNode'
    $name+= '.html'
    set-content $name -value $str

    Write-Host " Email Sending"


    $smtpServer = "HUBSERVER"
    $smtpFrom = "From Address"
    $smtpTo = "TO ADDRESS"
    $messageSubject = "Cluster Report"
    $message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
    $message.Subject = $messageSubject
    $message.IsBodyHTML = $true
    $message.Body = get-content "SPECIFY THE PATH OF HTML"
    $smtp = New-Object Net.Mail.SmtpClient($smtpServer)
    $smtp.Send($message)

    =====================================================================

    • Proposed as answer by Allen_WangJF Saturday, August 27, 2016 1:48 PM
    • Marked as answer by rush2ramki Monday, September 5, 2016 8:38 AM
    Saturday, August 27, 2016 4:00 AM
  • Hi,

    I'm very appreciate your sharing, you can mark you reply as answer to highlight for other customers.

    Thanks again.


    Allen Wang
    TechNet Community Support


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Saturday, August 27, 2016 1:50 PM