• Home
  • Topics
    • Office 365
    • Teams
    • SharePoint Online
    • Exchange 2019
    • Exchange 2016
    • Exchange 2013
    • Hybrid
    • Certificates
    • PowerShell
    • Migration
    • Security
    • Azure
  • Blog
  • Podcast
  • Webinars
  • Books
  • About
  • Videos
    • Interview Videos
    • How To Guide Videos
  • Subscribe
    • Facebook
    • Twitter
    • RSS
    • YouTube

Practical 365

You are here: Home / Exchange Server / Get-DAGHealth.ps1 – Database Availability Group Health Check Script

Get-DAGHealth.ps1 – Database Availability Group Health Check Script

February 14, 2013 by Paul Cunningham 260 Comments

Since I released the Test-ExchangeServerHealth.ps1 script one of the most common feature requests has been to add health checks for Database Availability Groups.

So I am pleased to announce the availability of Get-DAGHealth.ps1, a Database Availability Group health check PowerShell script.

Note that the functionality of this script has been merged with the Test-ExchangeServerHealth.ps1 script to provide a single, daily health check script that you can use for your Exchange environments. If you are looking for more than just DAG health I recommend trying Test-ExchangeServerHealth.ps1 instead.

Please read the usage instructions in below or in the script help info.

This script is available on the TechNet Script Gallery or Github. Comments are welcome below. If you find a bug please consider raising it as an issue on Github.

Running Get-DAGHealth.ps1

The script is written and tested for Exchange Server 2010 and Exchange Server 2013 CU1.

The script requires the Exchange Management Tools to run. You can execute it from the Exchange Management Shell, or a regular PowerShell session and it will add the Exchange snapin if not already loaded.

You can also execute it as a scheduled task. I use the follow settings in my scheduled task to make it work:

  • Run whether user is logged on or not
  • Run with highest privileges
  • Action:
    • Start a program: powershell.exe
    • Arguments: -command “c:\scripts\daghealth\get-daghealth.ps1 -Detailed -SendEmail”
  • You may need to modify your script execution policy to run this script as it is not signed
  • You may need to open the Properties of the downloaded file and “unblock” it before it will run

Use Get-Help to see more usage details and examples.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
PS C:\Scripts\DAGHealth\> get-help .\Get-DAGHealth.ps1 -Examples
 
NAME
    C:\Scripts\DAGHealth\Get-DAGHealth.ps1
 
SYNOPSIS
    Get-DAGHealth.ps1 - Exchange Server 2010 Database Availability Group Health Check Script.
 
    -------------------------- EXAMPLE 1 --------------------------
 
    C:\PS>.\Get-DAGHealth.ps1
 
    Checks all DAGs in the organization and outputs a health summary to the PowerShell window.
 
    -------------------------- EXAMPLE 2 --------------------------
 
    C:\PS>.\Get-DAGHealth.ps1 -Detailed
 
    Checks all DAGs in the organization and outputs a detailed health report to the PowerShell
    window. Due to the amount of detail the full report may get cut off in your window. I recommend
    detailed reports be output to HTML file or email instead.
 
    -------------------------- EXAMPLE 3 --------------------------
 
    C:\PS>.\Get-DAGHealth.ps1 -Detailed -SendEmail
 
    Checks all DAGs in the organization and outputs a detailed health report via email using
    the SMTP settings you configure in the script.


I generally recommend using the HTML file or email output to get the best results. The HTML output gives a color-coded health report to bring to your attention any potential health issues such as databases not active on their first preference server, unhealthy copies or queues, unhealthy content indexes, and other things that can sometimes go unnoticed with DAGs.

get-daghealth-output

The report is indicative only. You should investigate and validate any issues that it flags to determine what if any action is required to resolve them.

This script is available on the TechNet Script Gallery or Github. Comments are welcome below. If you find a bug please consider raising it as an issue on Github.

Change Log:

  • V1.0 – 14/02/2013 – Initial release
  • V1.1 – 24/04/2013 – Bug fixes, Exchange 2013 compatibility

Feedback and bug reports welcome in the comments below. If you like this script please feel free to share this article with your friends and colleagues on Twitter, Facebook, LinkedIn, Google+ etc. You might also be interested in some of my other PowerShell scripts.

Exchange Server DAG, Database Availability Group, Exchange 2010, PowerShell, Scripts

Comments

  1. Robert says

    June 14, 2017 at 3:41 am

    Love the script but I updated to include AutoSuspended lag copies in Exchange 2016 so they show up as green and happy.

    Reply
    • Paul Cunningham says

      June 14, 2017 at 9:17 am

      The Test-ExchangeServerHealth.ps1 script should also have that update, and I generally recommend using that one instead. I don’t maintain this DAG health script any more, after it was merged with Test-ExchangeServerHealth.ps1.

      Reply
  2. Trieu Truong says

    March 31, 2017 at 3:01 pm

    I’m facing with the issue when I trying to run this script.
    It was shown this error:
    Warning: \Location of this script\ignorelist.txt could not be found. No servers, DAGs or databases will be ignored.
    —— Finishing
    Done.

    I already stick unblock on those properties.

    Reply
  3. Thomas Manin says

    December 19, 2016 at 7:35 pm

    Waow thanks Paul !

    Reply
  4. Brettc says

    December 14, 2016 at 4:28 pm

    we’ve got a global exchange environment, but our region is restricted to a small number of servers+dags.
    currently the script is throwing connection errors for other region servers due to permissions errors for those servers.
    Is there any way to mod script to _only_ query specific servers/dags?
    we’ve used ignorelist.txt, but that doesn’t stop connection attempts to other database servers

    Reply
    • Paul Cunningham says

      December 19, 2016 at 11:15 pm

      Basically anywhere in the script that a Get-* cmdlet is running, like Get-DatabaseAvailabilityGroup, you can mod that line to suit your needs.

      Reply
  5. Royal Wang says

    November 2, 2016 at 12:42 pm

    $smtpsettings = @{
    To = “40802478@qq.com”
    From = “wyh33621999@126.com”
    Subject = “$reportemailsubject – $now”
    SmtpServer = “smtp.126.com”
    }

    Reply
  6. Amir says

    September 26, 2016 at 3:02 pm

    hi
    first of all i must say that its amazing,i had a question, when all my node are up in my cluster i run this script but i got FAILED in Database Redundancy and Database Availability
    how ever my dag is working well and databases switch over on my servers
    what’s this FAILED in my email?

    Reply
  7. Matthew Prentice says

    August 9, 2016 at 11:44 pm

    Paul,

    Thanks for the great script. Just made my life a lot easier.

    I made a minor code adjustment so I can have multiple To recipients in the settings.xml:

    $smtpsettings = @{
    To = [string[]]($ConfigFile.Settings.EmailSettings.MailTo -split “,”)
    From = $ConfigFile.Settings.EmailSettings.MailFrom
    SmtpServer = $ConfigFile.Settings.EmailSettings.SMTPServer
    Subject = “$($ConfigFile.Settings.EmailSettings.Subject) – $now”
    }

    This allows for one or more recipients separated by a comma.

    Reply
  8. Ripu Daman says

    August 8, 2016 at 8:52 pm

    How Can I add a section to show Dag is balanced or not, I can see it Visually but can I add a tab to see if all the DAG are balanced or not.

    Thanks,
    Ripu Daman

    Reply
  9. Jo says

    August 7, 2016 at 10:50 am

    Hi Paul…
    Great script! But, can’t get the ignorelist to work….what is the syntax for the ignorelist.txt?
    Thanks
    JP

    Reply
  10. Alan says

    July 27, 2016 at 1:09 am

    This script has worked like a charm for me for near 2 years in Exchange 2010. We are now deploying 2016, the script still works on our 2010 servers, but not on 2016, error is:
    “Could not load file or assembly ‘Microsoft.Exchange.Data, Version=14.0.0.0, Culture=neutral,
    PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.”
    Any ideas?

    Reply
  11. John Kindred says

    June 11, 2016 at 12:37 am

    Newbie here … can you give me instructions on how to set this up to run for the first time?

    Reply
  12. TLN says

    June 7, 2016 at 12:52 am

    Great script Paul,
    I have mix Ex2010/Ex2016 with 2 DAGs, when I ran the script on a Server 2008-R2 with Exchange 2010 powershell, the report does not shows the “Health Summary” and “Health Detail” for the EX2016’s DAG, it shows “Member Health”.
    The script failed when I ran it with Exchange 2016 powershell.
    Thanks

    Reply
  13. Ziac says

    May 16, 2016 at 10:43 am

    Hey Paul,

    This worked great!!! and i mean i automated it and no issues.
    what tips can you give me if i wanted to add drive space and stats on the report?

    Reply
  14. Sameh Khairy says

    May 8, 2016 at 11:15 pm

    Hi The script not working with me and i receive the below message

    WARNING: The file C:Scriptsignorelist.txt could not be found. No servers, DAGs or databases will be ignored.
    —— Finishing
    Sending email.
    Send-MailMessage : The specified string is not in the form required for an e-mail address.
    At C:ScriptsGet-DAGHealth.ps1:1092 char:20
    + Send-MailMessage <<<< @smtpsettings -Body $htmlreport -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF
    8)
    + CategoryInfo : InvalidType: (:) [Send-MailMessage], FormatException
    + FullyQualifiedErrorId : FormatException,Microsoft.PowerShell.Commands.SendMailMessage

    Send-MailMessage : A recipient must be specified.
    At C:ScriptsGet-DAGHealth.ps1:1092 char:20
    + Send-MailMessage <<<< @smtpsettings -Body $htmlreport -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF
    8)
    + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], InvalidOpe
    rationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.SendMailMessage

    Done.

    Reply
  15. Richard M says

    May 4, 2016 at 2:03 pm

    I have used the ignorelist.txt before for server names but is there a way to ignore a certain database copies like “database1server2” in the DAG Health Details or is the ignore only the database name which will ignore it for everything?

    Reply
    • Paul Cunningham says

      May 4, 2016 at 9:43 pm

      Currently it will ignore an entire database name.

      What’s your scenario/requirement here?

      Reply
      • Richard M says

        May 5, 2016 at 1:48 pm

        One of the members was going to be down for a couple of days so it was put into DAG maintenance mode and I just wanted to temporarily clean up the report while it was down, however that DAG member and its copies will be decommissioned tomorrow so its fine. Thank you for the reply and keep up the great work, your articles and replies are very helpful

        Reply
  16. David Kraxner says

    April 30, 2016 at 6:52 am

    This is a great script. I prefer it over the Test-ExchangeServerHealth because of the nice HTML Report.
    However I cannot get it to send emails to more than one person. I have tried separating the “TO” email addresses such as “joe@domain.org”, “Jane@domain.com” but no email ever arrives. I also tried a distribution list with the same result.

    The Quorum Group and File Share Quorum show as “FAILED” and highlighted in yellow for both of the two servers I have. What does that mean?

    Thanks Paul!!!

    Reply
    • Paul Cunningham says

      April 30, 2016 at 9:20 am

      The Test-ExchangeServerHealth.ps1 script has a HTML report as well.

      For multiple recipients I recommend sending the report to a distribution group.

      For the failed items, you’ll need to investigate your DAG/cluster config further.

      Reply
  17. Sven says

    January 28, 2016 at 9:53 pm

    Excellent Script! Thank you Paul

    Reply
  18. Sridhar says

    December 22, 2015 at 3:06 am

    Hi Paul,

    I am implemented this script in my origination and it’s working without any issues through exchange shell and also getting email notification as well. However I have created scheduled task for this and run the script but not getting email notification.

    Can you help me on this…

    Reply
  19. Sridhar says

    December 18, 2015 at 12:45 am

    Hi Paul,

    After make changes in script it’s working fine.

    I want to send this email report multiple users which strings I need to add in the script. Getting below error.

    Send-MailMessage : The specified string is not in the form required for an e-mail address.
    At E:Program FilesMicrosoftExchange ServerV14ScriptsGet-DAG Health.ps1:1076 char:20
    + Send-MailMessage <<<< @smtpsettings -Body $htmlreport -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF
    8)
    + CategoryInfo : InvalidType: (:) [Send-MailMessage], FormatException
    + FullyQualifiedErrorId : FormatException,Microsoft.PowerShell.Commands.SendMailMessage

    Send-MailMessage : A recipient must be specified.
    At E:Program FilesMicrosoftExchange ServerV14ScriptsGet-DAG Health.ps1:1076 char:20
    + Send-MailMessage <<<< @smtpsettings -Body $htmlreport -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF
    8)
    + CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], InvalidOpe
    rationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.SendMailMessage

    Can you help on this.

    Reply
    • Paul Cunningham says

      December 18, 2015 at 9:51 am

      If you want to send to multiple recipients I recommend you send to a distribution group.

      Reply
  20. Sridhar says

    December 16, 2015 at 1:59 am

    Hi Team,

    I want to implement this script on my organization.

    The script is working by using exchange shell with out any issues. The report not getting through email the required SMTP changes has been done and also I tracked the message report email not trigger to our exchange servers.

    Can someone help me on this.

    Reply
  21. Keith Pratola says

    September 22, 2015 at 11:13 pm

    So the script is great and I set it up to run as a scheduled task. Now the boss says that he only wants to receive an email if the DAG is not healthy or has failed over to the secondary site. Is that possible at all, or would that most likely come down to a paid for 3rd party solution?

    Reply
    • Paul Cunningham says

      September 23, 2015 at 9:26 am

      Test-ExchangeServerHealth.ps1, which is generally a better script, has a switch you can use to only send the email if alert conditions were found.

      https://www.practical365.com/powershell-script-health-check-report-exchange-2010/

      Reply
  22. Keith Pratola says

    September 22, 2015 at 11:03 am

    What happens when your company is using Gmail to receive the reports? For me in Outlook it looks fine with everything showing as green, but unfortunately Gmail removes all the colors which makes it harder for our NOC to easily identify an issue.

    Reply
    • Paul Cunningham says

      September 22, 2015 at 11:10 am

      HTML email renders differently in different email clients, webmail services, mobile devices, etc etc. It’s a big deal for marketers etc who want their emails designs to work for as many people as possible, and they pay designers and use expensive testing tools to achieve that.

      I’ve made a simple HTML email that works in Outlook, which is as far as I’ve gotten with it right now sorry 🙂

      Reply
      • Keith Pratola says

        September 22, 2015 at 11:28 am

        No worries. I use Outlook, so it looks good for me. Even on my iPhone since I am using the Outlook app. I’ll just have to remind them this is another reason why we should be using Exchange instead of Gmail. 🙂

        Reply
  23. Joel Smith says

    August 11, 2015 at 1:24 am

    I am also getting an empty screen…it just states …………finishing and then done on the next line with no output. Running two Exchange 2013 CU7 servers in a DAG. Piping output to html file made no difference, just an empty html file.

    Reply
    • Paul Cunningham says

      August 11, 2015 at 10:14 am

      Try running with the -Log switch and see if the log file has any clues. You can also use -Verbose.

      Reply
      • Cristian says

        August 19, 2016 at 9:07 pm

        Same error here, Exchange 2013 CU9.
        Log file only show these lines…
        08/19/2016 13:05:58 =====================================
        08/19/2016 13:05:58 Exchange Server DAG Health Check
        08/19/2016 13:05:58 08/19/2016 13:05:55
        08/19/2016 13:05:58 =====================================

        Reply
  24. Ilker Karaoglan says

    July 9, 2015 at 7:42 pm

    Hello there, looks like very extensive and great script.
    However when I run the script in mixed Exchange 2013 and Exchange 2010 environment I get empty report.
    Even in powershell screen, I see finished but no result in the screen nor in the folder itself.

    With kind regards.

    Reply
  25. Don Nash says

    June 30, 2015 at 12:12 am

    This is a great script. I have one issue that I am not sure how to resolve. Any suggestions will be greatly appreciated. I receive the following error most times when executing the Test-ExchangeServerHealth.ps1 script

    WARNING: Windows Failover Clustering encountered a transient error. Trying the operation again may be successful. Error: ‘IsNodeClustered’.

    Reply
  26. Luis Reyes says

    June 26, 2015 at 8:42 am

    In the report there is a field named “Preference”, but I do not what it means…

    Do you have any link where explain it? Or someone knows about it

    Grettings from Mexico

    Reply
    • Paul Cunningham says

      June 26, 2015 at 9:56 am

      Preference is “Activation Preference”.

      Some related reading:
      https://www.practical365.com/powershell-scripts-for-balancing-database-availability-groups/
      https://www.practical365.com/database-failover-wrong-server/

      Reply
  27. Matthias says

    June 17, 2015 at 12:16 am

    Hi Paul

    Ah I see. Since Get-DAGHealth.ps1 seems to be integrated in Test-ExchangeServerHealth.ps1, I want to run: Test-ExchangeServerHealth.ps1.

    Thanks

    Reply
    • Paul Cunningham says

      June 17, 2015 at 12:23 am

      In Test-ExchangeServerHealth.ps1 the -ReportMode parameter is a switch. No need to add $true after it.

      Reply
  28. Matthias says

    June 16, 2015 at 10:23 pm

    Hi Paul

    This seems to be very nice script. But I am not able to get a html file.
    If I change the ReportMode parameter to $true in line 114 as outlined in line 20 then I always get asked for the ReportMode parameter. There I can enter what ever I want. I only get the error:

    Cannot process argument transformation on parameter ‘ReportMode’. Cannot
    convert value “System.String” to type “System.Management.Automation.SwitchParameter”. Boolean parameters accept only
    Boolean values and numbers, such as $True, $False, 1 or 0.

    I run the script on an Exchange 2013 server with the roles: MBX and CAS.

    Do you have an idea what to do?

    Kind regards

    Matthias

    Reply
    • Paul Cunningham says

      June 16, 2015 at 11:22 pm

      Are you using the latest version? It doesn’t have a -ReportMode switch at all.

      Reply
  29. Roy Bobley says

    June 4, 2015 at 9:08 pm

    When I run Test-ExchangeServerHealth.ps1 it too says that the mail flow test failed. When I run Test-MailFlow it just times out and Fails. All appears to be working fine? What to do next??

    Reply
    • Roy says

      June 30, 2015 at 12:13 am

      Paul or anybody,
      Suggestions on what or how to test further??

      Reply
  30. Roy Bobley says

    June 4, 2015 at 1:29 am

    When I run this test, everything passes except the “Mail Flow Test” which Takes a long time and fails.

    What troubleshooting should I do next?

    Any help is appreciated!

    Roy

    Reply
    • Paul Cunningham says

      June 4, 2015 at 10:10 am

      You can try running the Test-Mailflow tests yourself manually. But really this isn’t being maintained and you should look to use Test-ExchangeServerHealth.ps1 instead.

      Reply
  31. Wammus says

    April 29, 2015 at 11:24 pm

    Had a problem running this script from a scheduled job. After troubleshooting using “Start-Transcript” I noticed it was not able to automatically connect to the Exchange servers:

    VERBOSE: Connecting to *******
    An internal error occurred.
    + CategoryInfo : InvalidArgument: (http://*******….tVer=14.3.123.4:Uri) [], PSInvalidOperationException
    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed

    (this error did not occur when running the script manual)

    I commented out line 280:
    # Connect-ExchangeServer -auto -AllowClobber
    And now it works like a charm!

    Great script! Thanks!

    Reply
  32. Scott McIntosh says

    March 11, 2015 at 11:41 pm

    I signed up as an insider and logged in, but cannot locate where I download this script

    Reply
  33. Mike says

    February 18, 2015 at 6:16 am

    Thanks Paul, this looks very useful.

    So far though, nothing. I run the script and…. nothing. No errors.

    I’ve modified the smtp variables, attempted to run to a file, to screen… nothing. Are there other variables to be changed besides the smtp settings?

    Reply
    • Paul Cunningham says

      February 18, 2015 at 10:54 am

      Without modifying anything if you just run the script it should find and check any DAGs in your org, and output the results to the screen. Start with that.

      This script is probably a bit out of date anyway. I recommend looking at my Test-ExchangeServerHealth.ps1 script which is more comprehensive.

      Reply
  34. KNADMIN says

    January 31, 2015 at 2:57 am

    Hi Paul,
    Big fan of your work. Your scripts have made my life a lot easier. I am attempting to run the DAG Health check script but am getting the following error:

    WARNING: Unable to get Primary Active Manager information due to an Active Manager call failure. Error: An Active Manager operation failed. Error
    Operation failed with message: Error 0x6d1 (The procedure number is out of range) from cli_AmGetDeferredRecoveryEntries.

    We have our domain with several regions. It’s possibly trying to read a DAG I don’t have access to? Can I get the script just to read the DAG’s I have access to? Like: Set-adserversettings -recipientviewroot usa.abc.com? Where would I insert that in?

    Reply
    • Paul Cunningham says

      January 31, 2015 at 1:11 pm

      Sounds possible. On line 103 of the script you can customize the Get-DatabaseAvailabilityGroup command to grab just the DAGs you want or exclude others.

      I haven’t developed this script much further after I rolled it into the Test-ExchangeServerHealth.ps1 script. That script has an ignorelist.txt that you can use to exclude specific DAG names if you need to.

      Reply
      • KNADMIN says

        February 19, 2015 at 3:06 am

        Hi Paul,
        The Ignore list in combination with the server list worked perfectly. Thanks again.

        Reply
      • Tauseef Ahmed Ansari says

        July 12, 2019 at 9:15 am

        Paul,

        Is there a way we can Skip “DBLogReplayKeepingUp” in test-replicationhealth cmdlet?

        Please help

        Reply
        • Tauseef Ahmed Ansari says

          July 12, 2019 at 9:15 am

          We have lagged copy setup in Exchange 2013 DAG.

          Reply
  35. k says

    December 4, 2014 at 1:50 am

    Hi, I am looking for a script to automate the client connections (MAPI, RPC/HTTPS, ActiveSync).
    In simple words i am looking for a script to do TestConnectivy.microsoft.com. Could you please help. Thanks.

    Reply
  36. Kush says

    November 11, 2014 at 2:01 am

    Hi Paul,

    How would you output the results to HTML. Can you please provide the syntax?

    Regards

    Kush

    Reply
  37. Marcel says

    November 7, 2014 at 7:40 am

    Hi,

    Today we’ve updated Exchange 2013 with CU6.
    If i run the script i get Cluster Network “*FAILED*”.
    The verbose output:
    [PS] C:Program FilesMicrosoftExchange ServerV15Scripts>C:Get-DAGHealth.ps1 -Detailed -SendEmail -Verbose -Debug
    VERBOSE: Retrieving Database Availability Groups
    VERBOSE: 1 DAGs found
    VERBOSE: —- Processing DAG DAG01
    VERBOSE: 2 DAG members found
    VERBOSE: 3 DAG databases found
    VERBOSE: —- Processing database DB01
    VERBOSE: DB01 has 2 copies
    VERBOSE: Database Copy: DB01SCL-RJE-ML-0001
    VERBOSE: Server: SCL-RJE-ML-0001
    VERBOSE: Activation Preference: 1
    VERBOSE: Status: Mounted
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: Database Copy: DB01SCL-RJE-ML-0002
    VERBOSE: Server: SCL-RJE-ML-0002
    VERBOSE: Activation Preference: 2
    VERBOSE: Status: Healthy
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: —- Processing database DB02
    VERBOSE: DB02 has 2 copies
    VERBOSE: Database Copy: DB02SCL-RJE-ML-0002
    VERBOSE: Server: SCL-RJE-ML-0002
    VERBOSE: Activation Preference: 1
    VERBOSE: Status: Mounted
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: Database Copy: DB02SCL-RJE-ML-0001
    VERBOSE: Server: SCL-RJE-ML-0001
    VERBOSE: Activation Preference: 2
    VERBOSE: Status: Healthy
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: —- Processing database SPAM
    VERBOSE: SPAM has 2 copies
    VERBOSE: Database Copy: SPAMSCL-RJE-ML-0001
    VERBOSE: Server: SCL-RJE-ML-0001
    VERBOSE: Activation Preference: 1
    VERBOSE: Status: Mounted
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: Database Copy: SPAMSCL-RJE-ML-0002
    VERBOSE: Server: SCL-RJE-ML-0002
    VERBOSE: Activation Preference: 2
    VERBOSE: Status: Healthy
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0
    VERBOSE: Content Index: Healthy
    VERBOSE: Replay lag is False
    VERBOSE: Truncation lag is False
    VERBOSE: —- Checking replication health for SCL-RJE-ML-0001
    VERBOSE: ClusterService Passed
    VERBOSE: ReplayService Passed
    VERBOSE: ActiveManager Passed
    VERBOSE: TasksRpcListener Passed
    VERBOSE: TcpListener Passed
    VERBOSE: ServerLocatorService Passed
    VERBOSE: DagMembersUp Passed
    VERBOSE: MonitoringService Passed
    VERBOSE: ClusterNetwork *FAILED*
    VERBOSE: QuorumGroup Passed
    VERBOSE: FileShareQuorum Passed
    VERBOSE: DatabaseRedundancy Passed
    VERBOSE: DatabaseAvailability Passed
    VERBOSE: DBCopySuspended Passed
    VERBOSE: DBCopyFailed Passed
    VERBOSE: DBInitializing Passed
    VERBOSE: DBDisconnected Passed
    VERBOSE: DBLogCopyKeepingUp Passed
    VERBOSE: DBLogReplayKeepingUp Passed
    VERBOSE: —- Checking replication health for SCL-RJE-ML-0002
    VERBOSE: ClusterService Passed
    VERBOSE: ReplayService Passed
    VERBOSE: ActiveManager Passed
    VERBOSE: TasksRpcListener Passed
    VERBOSE: TcpListener Passed
    VERBOSE: ServerLocatorService Passed
    VERBOSE: DagMembersUp Passed
    VERBOSE: MonitoringService Passed
    VERBOSE: ClusterNetwork *FAILED*
    VERBOSE: QuorumGroup Passed
    VERBOSE: FileShareQuorum Passed
    VERBOSE: DatabaseRedundancy Passed
    VERBOSE: DatabaseAvailability Passed
    VERBOSE: DBCopySuspended Passed
    VERBOSE: DBCopyFailed Passed
    VERBOSE: DBInitializing Passed
    VERBOSE: DBDisconnected Passed
    VERBOSE: DBLogCopyKeepingUp Passed
    VERBOSE: DBLogReplayKeepingUp Passed
    —- Database Copy Health Summary —-

    Database Mounted on Preference Total Copie Healthy Cop Unhealthy C Healthy Que Unhealthy Q Lagged Queu Healthy Ind
    s ies opies ues ueues es exes
    ——– ———- ———- ———– ———– ———– ———– ———– ———– ———–
    DB01 SCL-RJE-… 1 2 2 0 2 0 0 2
    DB02 SCL-RJE-… 1 2 2 0 2 0 0 2
    SPAM SCL-RJE-… 1 2 2 0 2 0 0 2

    —- Database Copy Health Details —-

    Database Na Database Co Mailbox Ser Activation Status Copy Queue Replay Queu Replay Lagg Truncation Content Ind
    me py ver Preference e ed Lagged ex
    ———– ———– ———– ———– —— ———- ———– ———– ———– ———–
    DB01 DB01SCL… SCL-RJE-… 1 Mounted 0 0 False False Healthy
    DB01 DB01SCL… SCL-RJE-… 2 Healthy 0 0 False False Healthy
    DB02 DB02SCL… SCL-RJE-… 1 Mounted 0 0 False False Healthy
    DB02 DB02SCL… SCL-RJE-… 2 Healthy 0 0 False False Healthy
    SPAM SPAMSCL… SCL-RJE-… 1 Mounted 0 0 False False Healthy
    SPAM SPAMSCL… SCL-RJE-… 2 Healthy 0 0 False False Healthy

    —- Server Test-Replication Report —-

    Server ClusterServ ReplayServi ActiveManag TasksRpcLis TcpListener ServerLocat DagMembersU MonitoringS ClusterNetw
    ice ce er tener orService p ervice ork
    —— ———– ———– ———– ———– ———– ———– ———– ———– ———–
    SCL-RJE-… Passed Passed Passed Passed Passed Passed Passed Passed *FAILED*
    SCL-RJE-… Passed Passed Passed Passed Passed Passed Passed Passed *FAILED*

    Do you have any idea why this reports failed?

    Thanks in advance,

    Marcel

    Reply
    • Paul Cunningham says

      November 7, 2014 at 9:23 am

      Run Test-Replication health and look at the details there. You might need to do “test-replicationhealth | fl” to see more info.

      If there’s no help there look in the event logs for more clues.

      The script is just reporting what it sees, it can’t troubleshoot for you.

      Reply
      • Marcel says

        November 8, 2014 at 6:22 am

        Hi Paul,

        Thanks for your quick reply!
        I’ve been able to fix the “misconfigured” issue it had to do with IPv6.
        All is ok now and I can confirm that both this and the Exchange Server Health Check Report work fine with CU6.

        Have a nice weekend.

        Marcel

        Reply
  38. Tuan Bui says

    October 27, 2014 at 2:58 pm

    Hi Paul
    I running Scipt on Coexist exchange 2010 and exchange 2013.
    I had 2 DAG (1 For Exchange 2010 and 1 Exchange 2013). Exchange 2010 was OK, but Exchange 2013 not Run
    It not get healthy DAG exchange 2013 with Error
    Could not load file or assembly ‘Microsoft.Exchange.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The
    system cannot find the file specified.
    + CategoryInfo : NotSpecified: (:) [Get-DatabaseAvailabilityGroup], FileNotFoundException
    + FullyQualifiedErrorId : [Server=XXX2013,RequestId=faca3730-5443-4548-90e8-bddf46d82352,TimeStamp=10/27/2014 11:48:46 AM] [FailureCategory=Cmdlet-F
    ileNotFoundException] AF360ECA,Microsoft.Exchange.Management.SystemConfigurationTasks.GetDatabaseAvailabilityGroup
    + PSComputerName : XXX2013.domain.com

    Please can You help me fix it?

    Reply
  39. jtsai says

    October 15, 2014 at 8:30 am

    I’m getting all the info except for server column on the last section for test-replication… any idea? lastest Exchange 2010 SP & Rollup.

    Reply
    • Paul Cunningham says

      October 15, 2014 at 2:40 pm

      Hi, can you try with the latest version of Test-ExchangeServerHealth.ps1 instead? That has some bug fixes that haven’t been added back to Get-DAGHealth.ps1.

      Reply
  40. jacob says

    October 7, 2014 at 5:17 pm

    i can’t recive the email report

    Reply
    • Paul Cunningham says

      October 8, 2014 at 4:20 pm

      What have you tried so far to get it working?

      Reply
      • Matt says

        October 8, 2014 at 4:23 pm

        Gone back to the author of the script with a lot of detail on what the issue is and didn’t at all just say something very general that is impossible to troubleshoot.

        🙂

        Reply
      • jacob says

        October 8, 2014 at 4:30 pm

        i run it on my on premis cas and it run perfectly but it doesn’t send me email although i config the mail on the “Modify these Email Settings”

        Reply
        • Paul Cunningham says

          October 8, 2014 at 11:05 pm

          From the server that you’re running the script on try telnet to the SMTP server you’re using in the script settings and test SMTP that way.

          Here’s how to do that:
          https://www.practical365.com/how-to-send-email-via-telnet/

          Reply
  41. Ranga says

    September 20, 2014 at 9:43 am

    Paul,

    Excellent script and very quick to get report in friendly viewable format

    In Exchange 2013 during the issue When I run the Test-replication health on individual server it shows the failure in DatabaseRedundancy & ‘DatabaseAvailability .

    Results on DAG Servers:
    DatabaseRedundancy *FAILED* There were database redundancy check failures for database ‘DatabaseAvailability *FAILED* There were database availability check failures for database

    But when I run the this script the failure details are not captured i.e the fields DatabaseRedundancy &DatabaseAvailability are not available in the HTML report.

    Can you please help here?

    Reply
  42. Yogesh says

    August 14, 2014 at 6:37 pm

    Very Often I see the reports show “File Share Quorum” as “*FAILED*

    Is it something that It can not fetch into report?
    But then I manually run it after sometime and get all as passed.

    Reply
  43. Yogesh says

    July 30, 2014 at 4:35 pm

    Hi Paul,

    This is just great..
    I have two DAG in my exchange but I want a summary report of only one DAG.
    How can I do that? Can You guide me to changes required? I am a powershell beginner.

    Reply
    • Paul Cunningham says

      July 31, 2014 at 11:22 am

      On line 103 of the script change the line:

      $dags = @(Get-DatabaseAvailabilityGroup -Status)

      to read

      $dags = @(Get-DatabaseAvailabilityGroup -Status YOURDAGNAMEHERE)

      Reply
      • Yogesh says

        July 31, 2014 at 9:54 pm

        That’s Great.

        Still it tries to connect to other DAG Servers and displays error as ” unable to connect to Information Store service on Server1.*****.com”.

        Reply
  44. kwaks says

    July 14, 2014 at 10:38 pm

    Hi,
    is this download no longer available?
    I’m logged in, but unfortunately I’m not able to download this script. There is now download button or sth. else…

    Reply
    • Paul Cunningham says

      July 15, 2014 at 5:08 pm

      Download links are in the members area at http://inside.exchangeserverpro.com/members

      Reply
  45. Ben Stephenson says

    June 30, 2014 at 1:48 pm

    Great Script thank-you Paul!!!!

    Just wanted to quickly share, I had the same issue a few had that on a SP1 and above 2010 Exchange server the database preference column had stopped working. To fix I needed to change the $mailboxserver attribute to return a title-case value rather than upper case as this is the format the “ActivationPreference” section now returned.

    Here was my hack to fix (not a script-guy so may be better ways to do it sorry):

    changed:

    $mailboxserver = $dbcopy.MailboxServer
    Write-Verbose “Server: $mailboxserver”

    to:

    $mailboxserverupper = $dbcopy.MailboxServer
    $TextInfo = (Get-Culture).TextInfo
    $mailboxserver = $TextInfo.ToTitleCase($mailboxserverupper.ToLower())
    Write-Verbose “Server: $mailboxserver”

    All working properly now, thanks again for your hard work!

    Cheers
    Ben

    Reply
  46. Hector Alvarez says

    June 15, 2014 at 8:26 am

    Great script!
    Very useful, I use it to monitor a DAG that expands across 3 sites.
    I do have a quick question. I noticed that the script reports that one of the Exchange servers “DB Log replay keeping up” Failed.
    Now, I have setup database copies to that server to be lagged by 12 hours and I’m wondering if that is the reason for the “Failed” report or if it is an issue I need to look into it.
    Thank you

    Reply
  47. Barry Sherman says

    June 12, 2014 at 1:02 am

    I am using the script and it works until I get to the send email switch. I am running the command as follows: .Get-DAGHealth.ps1 -Detailed -SendEmail

    When it gets to the sending email part I get the following error:
    Send-MailMessage : Service not available, closing transmission channel. The server response was: 4.3.2 Service not active

    Any ideas?? Otherwise, an AWESOME script!!

    Reply
    • Paul Cunningham says

      June 12, 2014 at 12:38 pm

      I’d say you’re pointing at a server that is either not running an SMTP service or is rejecting the connection. Not really a script issue, just something you need to troubleshoot.

      https://www.practical365.com/how-to-send-email-via-telnet/

      Reply
  48. Jason says

    June 10, 2014 at 12:39 am

    while trying to run your script i realized it is going to try and pull all DAGS in my forest which for my group that is around 50 or so of them, i only care about the ones i control, is there anyway to tell this script to look at one specific DAG or a group of dags that have the same general name?

    Reply
    • Paul Cunningham says

      June 10, 2014 at 11:06 am

      Modify the script line where it fetches the DAGs (using Get-DatabaseAvailabilityGroup).

      Or run Test-ExchangeServerHealth.ps1 instead which has an ignorelist.txt file you can use to exclude servers, databases, or DAGs.

      Reply
  49. Robert Eriksson says

    May 14, 2014 at 5:12 pm

    Hi

    Great script!!
    However I updated my servers to SP1 and now it doesn’t report like before.
    Preference is blank under “Database Availability Group DAG-SPL-01 Health Summary”. Activation Preference is blank under “Database Availability Group DAG-SPL-01 Health Details”. and not server names under “Database Availability Group DAG-SPL-01 Member Health”
    Known issue?

    Best regards
    Robert

    Reply
    • Paul Cunningham says

      May 15, 2014 at 2:43 pm

      I’ll test it out when I have an SP1 DAG available again in the lab.

      Reply
      • Robert Eriksson says

        May 15, 2014 at 6:34 pm

        Hi

        We had one Archive-server left for upgrading to SP1 that I forgot. So I upgraded it tonight and now this morning the reports looks good again… so it seems to have resolved itself when all servers hade SP1… if that is logical?!

        Thank you!
        Regards
        Robert

        Reply
  50. Cobus Faasen says

    March 25, 2014 at 12:48 am

    Hi Paul,

    I ran the Test-ExchangeServerHealth.ps1 script, and the same thing happens. It generates the HTML file but the activation preference next to my 5th server is blank

    Reply
  51. Tony. Pere says

    March 21, 2014 at 5:05 am

    Thanks Paul,
    The script works like a charm.

    Reply
  52. Cobus Faasen says

    March 20, 2014 at 7:44 pm

    Hi, please see output for the Get-MailboxDatabase | select name,activationpreference command

    Name : 1024-Normal Users (A-F)
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Name : 1024-Normal Users (G-L)
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Name : 1024-Generic Users
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Name : 1024-VIP Users
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Name : 1024-Normal Users (R-Z)
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Name : 1024-Normal Users (M-Q)
    ActivationPreference : {[xxxxxx, 1], [xxxxxx, 2], [xxxxxx, 3], [xxxxxx, 4], [xxxxxx, 5]}

    Reply
  53. Cobus Faasen says

    March 20, 2014 at 7:31 pm

    Hi all, the script runs fine and I get an output in HTML. However it is not showing the activation preference for databases on one server at all.

    If I run the Get-MailboxDatabase | select name,activationpreference command it show the activation preference as 5 which is correct.

    However on the reports the field is just blank and does not show a value of 5

    Reply
    • Paul Cunningham says

      March 23, 2014 at 7:27 pm

      Can you try the Test-ExchangeServerHealth.ps1 script instead and see whether it has the same problem?

      Reply
  54. Vincent says

    March 12, 2014 at 7:41 pm

    Hello,

    Thanks for this script, look like very nice.

    Can i execute this script just for a specific DAG ?

    Cause i have many dag in my organisation with Domain contoller not open.
    So i have a lot of error.

    Thanks a lot for feedback

    Reply
  55. Vinod says

    February 25, 2014 at 6:01 pm

    the script is not accepting more than one email address, Paul can you please take a look?

    Reply
    • Paul Cunningham says

      February 25, 2014 at 8:18 pm

      Separate the emails with a comma, and wrap each one in quotes. Eg,

      “email1@domain.com”,”email2@domain.com”

      Or even easier, use a distribution group.

      Reply
      • Vinod says

        February 26, 2014 at 3:28 pm

        It is working fine now.

        Thanks for swift reply and great script as usual. 🙂

        thanks again

        Reply
  56. Andi says

    February 21, 2014 at 11:29 pm

    Is there a version with a parameter called DAGName ? We have about 12 DAG´s in the organization and i only need the health report from one of them…

    Reply
    • Paul Cunningham says

      February 23, 2014 at 8:30 pm

      No, but if you add the other 11 DAG names to the ignorelist.txt the script should ignore them.

      Reply
      • Andi says

        February 24, 2014 at 6:25 pm

        Thanks for your fast reply !

        Does the Get-DAGHealth.ps1 script use the ignorelist.txt automatically when it is in the same folder ?
        Whats the syntax inside the ignorelist.txt ?

        Reply
        • Paul Cunningham says

          February 24, 2014 at 8:26 pm

          Sorry, my bad, I thought we were talking about the Test-ExchangeServerHealth.ps1 script that this DAG health check was rolled into a while ago.

          To be honest this Get-DAGHealth.ps1 script is lagging behind a bit on bug fixes and feature improvements, but it still works for most people.

          So in your case I’d just recommend modifying line 103

          $dags = @(Get-DatabaseAvailabilityGroup -Status)

          …so that it only grabs the DAG you’re interested in, eg

          $dags = @(Get-DatabaseAvailabilityGroup -Status YOURDAGNAME)

          Reply
  57. mhd says

    January 17, 2014 at 2:43 pm

    Hi
    my dag seems healthy
    all mailboxdatabasescopysatus are healthy or mounted
    tet-replication health show everything passed
    but when i run this script it does not show me the passed status for mailbxo2
    i mean in the last table which it says about member health, mailbox2 cells are blank or n/a

    also when i run the script first it syas

    Windows Failover Clustering encountered a transient error. Trying the operation again may be successful. Error: ‘IsNodeClustered’.

    + CategoryInfo : NotSpecified: (0:Int32) [Test-ReplicationHealth], ExClusTransientException
    + FullyQualifiedErrorId : 2A256D90,Microsoft.Exchange.Monitoring.TestReplicationHealth

    Add-Member : Cannot bind argument to parameter ‘Name’ because it is null.
    At C:UsersmganjidaDesktopMailbox Scripts GanjiGet-DAGHealth.ps1:289 char:47
    + $memberObj | Add-Member NoteProperty -Name <<<< $($healthitem.Check) -Value $($healthitem.Result)
    + CategoryInfo : InvalidData: (:) [Add-Member], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddMemberCommand

    and then it goes to end and completed
    can you please help me on this

    Reply
    • Arun says

      February 8, 2016 at 8:24 pm

      @mhd, were you able to figure out the issue and get it resolved? Can you please provide some inputs? Even i’m getting the same problem.

      Reply
  58. JackSeth says

    January 11, 2014 at 7:10 am

    Got working. I had to enter the servername. Works great now. Very usefull

    Reply
  59. GC says

    January 5, 2014 at 8:18 am

    I don’t want to create a distribution group for 2 recipients… Has anyone been able to define multiple recipients on the To = line? Using “firstemailaddress”,”secondemaladdress” only sends to the second one specified…

    Reply
    • GC says

      January 5, 2014 at 8:34 am

      Nevermind… I was not being patient enough… Great Script Paul! Thank you.

      Reply
  60. JackSeth says

    January 1, 2014 at 5:04 am

    I meant Paul, sorry for calling you Chris lol!!!

    Reply
  61. JackSeth says

    December 31, 2013 at 10:26 am

    Hi Chris, Great script. I am getting an error. I am not getting output on the Health Summary and Health Details. I do get output on the Server Test-Replication Report

    You must provide a value for this property.
    + CategoryInfo : NotSpecified: (0:Int32) [Get-MailboxDatabase], DataValidationException
    + FullyQualifiedErrorId : CEA6502,Microsoft.Exchange.Management.SystemConfigurationTasks.GetMailboxDatabase
    + PSComputerName : sj2-exca101.corp.ourdomain.com

    Reply
  62. chander says

    December 4, 2013 at 4:26 am

    Once Again Paul, Great work. Thank You for this and many other GREAT articles.

    Reply
  63. Simon Craner says

    October 18, 2013 at 1:13 am

    Hi All,
    I am trying to run this in my environment, trick is we shared an org with anotehr company.
    we have our own dag, with trying to edit the script to only target my dag, i dont get full details under Health Summary or Health Details, all under member health is fine.

    Any ideas?

    Reply
    • Simon Craner says

      October 18, 2013 at 1:26 am

      got it to work, it still scans other servers in the org, but report is only my stuff, say yay.
      once again, thanks Paul for a great script. Going to use this as a daily task now.

      Reply
  64. Bill Keran says

    September 18, 2013 at 12:56 am

    Feature Request and Question.
    Any Change of getting DB size included in this report?
    And, can the report be emailed as an attachment vs. embeded in the email?

    Thanks!

    I think this is THE best script I have found!

    Reply
  65. StatikD says

    September 7, 2013 at 6:12 pm

    Paul,

    Don’t know how tough it would be to add, but I’m supporting a large enterprise environment, and I was wondering if a status indicator, or progress of the script could be added. I’ve been running the script for about 35-40 minutes….

    Of course, once I get an idea of how long this script would actually take to run, it might not be necessary, but for testing purposes, it would be a good indicator.

    Just a thought.

    Thanks!

    Jeff

    Reply
    • Paul Cunningham says

      September 7, 2013 at 6:21 pm

      You can currently use -Verbose if you want to observe the progress of the script as it’s running.

      Reply
  66. Julian Stephan says

    August 15, 2013 at 5:23 am

    Hi Paul,

    Is there a way that we can run this report on multiple DAGs but possibly add an ignore line referencing a text file to not run on certain DAGs. We currently have 10 DAGs in our 2013 environment, but only 2 are in production so far with users.

    Reply
    • Paul Cunningham says

      August 18, 2013 at 12:01 am

      Look for the line in the script where Get-DatabaseAvailabilityGroup is run and modify that so it includes/excludes the DAGs you want. I’ll look at incorporating an “ignore” list into a future update.

      Reply
  67. Matt says

    July 10, 2013 at 12:08 pm

    Hey Paul,

    Does this work ok on 2013 CU1?

    We are doing a test migration from 2010 to 2013. I have created a new DB on the 2013 infrastructure and added it to a new 2013 DAG. In EAC, is is definately showing as healthy on both MBX servers and both servers are listed under ‘Servers with copies’, but when running the Get-DagHealth, it is reporting:

    VERBOSE: Retrieving Database Availability Groups
    VERBOSE: 1 DAGs found
    VERBOSE: —- Processing DAG DAGPREP1
    VERBOSE: 2 DAG members found
    VERBOSE: 0 DAG databases found

    Reply
    • Paul Cunningham says

      July 11, 2013 at 11:03 pm

      What happens when you run this command? (use your DAG name instead of mine of course)

      Get-MailboxDatabase -Status | Where-Object {$_.MasterServerOrAvailabilityGroup -eq “E15DAG”}

      Reply
      • Matt says

        July 12, 2013 at 7:29 am

        Hey Paul,

        It returns the database OK:

        Get-MailboxDatabase -Status | Where-Object {$_.MasterServerOrAvailabilityGroup -eq “DAGPREP1”}

        Name Server Recovery ReplicationType
        —- —— ——– —————
        DB-2013-1 EX2013-MBX2 False Remote

        Reply
        • Paul Cunningham says

          July 12, 2013 at 10:12 am

          Hmmm, I’ll have to look into it further. My test lab works okay, thats all I can really say for now.

          Reply
        • Matt says

          July 12, 2013 at 10:14 am

          No worries Paul, thank you.

          Can you see my email address that I have entered when posting these comments?

          If so, feel free to email me directly if you want some information regarding the configuration to assist. It is pretty much a stock standard install, in coexistence with exchange 2010, a new database created on the 2013 MBX server and added into the new DAG that was created on the 2013 infrastructure.

          Reply
          • Paul Cunningham says

            July 12, 2013 at 10:16 am

            Ah okay, I haven’t tested it in a 2010/2013 co-existence yet. Are you running it from the Exchange 2010 or 2013 server?

        • Matt says

          July 12, 2013 at 10:20 am

          Doh! I didn’t even think to try from the 2013 server.

          I have just moved the script to a 2013 CAS server and it ran fine – fully reports on the DAG and the database in the DAG. Thanks for that. #FlipDeskFriday

          Reply
          • Paul Cunningham says

            July 12, 2013 at 10:33 am

            LOL. But at least that confirms what I suspected, that it will need to run using the higher version tools in a co-existence. Thanks 🙂

  68. Julian Stephan says

    July 10, 2013 at 12:01 am

    Paul,

    Is there a way to integrate if a DB is mounted on act. preference 2 to show which server it needs to be mounted on for act preference 1?

    Thank you,
    Julian

    Reply
    • Paul Cunningham says

      July 11, 2013 at 10:35 pm

      That information is already in the report in the details section below the health summary.

      Reply
  69. Jan says

    July 3, 2013 at 7:00 pm

    Hi,

    cool script… One suggestion – what you also could check is percentage of free space on the repsective DB/log disks and drop a warning if it goes below some threshold. Last successfult backup date could also be useful.

    keep up the good work
    Jan

    Reply
  70. Chris says

    June 18, 2013 at 11:17 pm

    Hi,
    Thanks for writing this script. I have run the script and it sends me an e-mail but there is no data (blank). Any ideas why? I also get the errors described above after running. Thanks.

    Reply
    • Paul Cunningham says

      June 18, 2013 at 11:19 pm

      There’s over 100 comments above yours, I can’t tell which one you’re referring to. Which errors are you seeing?

      Reply
      • Chris says

        June 19, 2013 at 5:09 am

        This is the error…sorry about that.

        Update-TypeData : The following error occurred while loading the extended type data file:
        Microsoft.PowerShell, D:Program FilesMicrosoftExchange ServerV14binexchange.types.ps1xml : File skipped because it was already present from “Microsoft.PowerShell”.
        At D:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1:94 char:17
        + Update-TypeData <<<< -PrependPath $typeFilePath
        + CategoryInfo : InvalidOperation: (:) [Update-TypeData], RuntimeException
        + FullyQualifiedErrorId : TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand

        Update-TypeData : The following error occurred while loading the extended type data file:
        Microsoft.PowerShell, D:Program FilesMicrosoftExchange ServerV14binExchange.partial.Types.ps1xml : File skipped b
        ecause it was already present from "Microsoft.PowerShell".
        Microsoft.PowerShell, D:Program FilesMicrosoftExchange ServerV14binexchange.types.ps1xml : File skipped because it was already present from "Microsoft.PowerShell".
        At D:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1:104 char:16
        + Update-TypeData <<<< -PrependPath $partialTypeFile
        + CategoryInfo : InvalidOperation: (:) [Update-TypeData], RuntimeException
        + FullyQualifiedErrorId : TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand

        Reply
        • Paul Cunningham says

          June 19, 2013 at 10:38 am

          You can just ignore those, they aren’t harmful to the running of the script.

          If you’re not getting any results try running the script with the -Verbose parameter and look through the output it produces.

          Reply
  71. JD says

    June 18, 2013 at 7:29 am

    Excellent Script Paul…..But i would like to exclude few DBs in this report… How to do that ?

    Reply
  72. Joel says

    June 15, 2013 at 9:00 am

    Excelente trabajo

    Reply
  73. Maxim says

    May 20, 2013 at 5:29 pm

    Great script!!!!

    Reply
  74. ajk says

    May 11, 2013 at 1:51 pm

    how to customize this script to run against one daggroup?

    Reply
    • Paul Cunningham says

      May 13, 2013 at 10:25 am

      Look for the line in the script where Get-DatabaseAvailabilityGroup is and modify that line to just get the DAG you’re interested in.

      Reply
      • ajk says

        May 14, 2013 at 12:20 am

        Thanks Paul

        Reply
  75. Skye says

    April 29, 2013 at 9:38 pm

    I have a proposal for a new feature / improvement;

    We have hundereds of databases, so the output spans several screens. This prevents us from easily spotting problems a a glance on a monitoring screen.

    Would be great to have a switch (say -failureonly) that lists only the ‘failures’ in the output from;

    Database Availability Group Health Details
    Database Availability Group Health Summary

    cheers

    Reply
  76. Skye says

    April 29, 2013 at 9:32 pm

    Great script, I do get a warning when running it , but the output seems fine on first glance;

    WARNING: Unable to get Primary Active Manager information due to an Active
    Manager call failure. Error: An Active Manager operation failed. Error
    Operation failed with message: Error 0x6d1 (The procedure number is out of
    range) from cli_AmGetDeferredRecoveryEntries.

    Reply
  77. Skye says

    April 29, 2013 at 7:47 pm

    There is a bug in the script :

    Once the UPTIME counter reaches 1000+ hours, it shows ‘1’ in the HTML output.

    We only just noticed this, because of monthly security updates force reboots often, except recently.

    Reply
    • Paul Cunningham says

      April 29, 2013 at 8:03 pm

      In this script?

      Reply
      • Skye says

        April 29, 2013 at 8:27 pm

        No, the health check script, this one doesn’t do uptime 🙂

        Its this bit: [int]$uptime = “{0:N0}” -f $uptime

        Reply
    • Skye says

      April 29, 2013 at 9:39 pm

      Woops, wrong forum, this bug is in the ‘health check’ script , not the DAG one.

      Reply
  78. Stephen says

    April 26, 2013 at 10:32 pm

    I am having an issue with the scheduled task when i run it nothing happens but if I run the script manually with the options I get the email. For the arguments this is what i have:
    -command “c:scriptsdaghealthget-daghealth.ps1 -Detailed -SendEmail”.
    Am i doing something wrong

    Reply
    • Paul Cunningham says

      April 26, 2013 at 11:21 pm

      Please make sure you have checked all the items in that bullet list I include in the article for running the script.

      Reply
      • Stephen says

        April 27, 2013 at 12:36 am

        Ok i was trying to run it with a service account that has the password set to not expire but cannot log on locally to the server. It works with my domain admin account so I guess I will have to change the password on the task every month

        Reply
        • Paul Cunningham says

          April 27, 2013 at 8:14 am

          It doesn’t need to be a domain admin account. I’ll try and write up the specific RBAC roles the account needs to run this script without giving it too many rights.

          Reply
        • Stephen says

          April 29, 2013 at 9:21 pm

          Ok will appreciate that. I tried running it with the local administrator account but it runs for several minutes without any output

          Reply
        • Paul Cunningham says

          April 29, 2013 at 9:24 pm

          Local accounts certainly won’t work, it does need to be a domain account. From memory it needs at least Exchange View-Only Org rights (there’s an existing group for that) and I think I also needed it to be a member of the local administrators group on the management server I run it on, presumably due to some PowerShell requirement that I haven’t quite worked out.

          Reply
  79. Brian says

    April 26, 2013 at 6:14 pm

    Hi Paul,

    Thanks for the script and Awesome work, challenge is when i execute is doens’t generate all the output on the email and i get the following errors on the Shell window;
    “You must provide a value for this property.
    + CategoryInfo : NotSpecified: (0:Int32) [Get-MailboxDatabase], DataValidationException
    + FullyQualifiedErrorId : 16C4924A,Microsoft.Exchange.Management.SystemConfigurationTasks.GetMailboxDatabase”

    This two sections are not populated on the email;
    “Database Availability Group SVDTDAG01 Health Summary:
    Database Mounted on Preference Total Copies Healthy Copies Unhealthy Copies Healthy Queues Unhealthy Queues Lagged Queues Healthy Indexes Unhealthy Indexes
    Database Availability Group SVDTDAG01 Health Details:
    Database Copy Database Name Mailbox Server Activation Preference Status Copy Queue Replay Queue Replay Lagged Truncation Lagged Content Index
    Database Availability Group SVDTDAG01 Member Health:”

    Kind Regards,
    Brian

    Reply
    • Paul Cunningham says

      April 26, 2013 at 9:07 pm

      Run it with the -Verbose switch and see if you spot any errors or warnings.

      Reply
  80. Julien says

    April 25, 2013 at 5:40 pm

    Very great job and wonderful script !

    Few questions :
    – When I do a detailed report, all the cells in the DAG Member Health array (last array) are yellow and there is “Transmis” inside. What does it mean ? (I’m on Exchange 2013 with CU1)
    – Do you plan to make Test-ExchangeServerHealth.ps1 & Get-DailyBackupAlerts.ps1 Exchange 2013 compatible ? (It would be great 🙂

    Reply
    • Paul Cunningham says

      April 25, 2013 at 8:23 pm

      The first problem sounds like a non-English language server. I have an idea how to make that easier to deal with but for now you’d need to just look at the HTML generating sections of the script and possibly replace English words like “Success” and “Passed” to your language’s word.

      Yes, I plan to test and update all the scripts for Exchange 2013 as time permits.

      Reply
      • Julien says

        April 26, 2013 at 6:40 pm

        Thanks a lot, that was it !

        Reply
  81. Gilberth says

    April 25, 2013 at 10:39 am

    Hello Paul this is a great script I have only one question, how I can have the report sent by email when autentication is required ?

    Reply
    • Paul Cunningham says

      April 25, 2013 at 11:25 am

      Send-MailMessage (way down the bottom of the script) has a -Credential parameter. I’d recommend using a low privilege account credential.

      Technet:
      http://technet.microsoft.com/en-us/library/hh849925.aspx

      Reply
  82. Paul Cunningham says

    April 24, 2013 at 9:14 pm

    Version 1.1 of Get-DAGHealth.ps1 is now available for download via the link in the article above.

    Thanks to those who have provided bug reports and feedback so far. I appreciate your help making this script accurate and useful.

    Reply
    • Tabish Mohmad says

      April 22, 2014 at 6:26 am

      Hi Paul,

      Amazing script!

      Thanks a lot.

      Reply
  83. Andrew says

    April 24, 2013 at 12:11 am

    Hi,

    Great script thanks Paul 🙂 I have setup scheduled tasks on your other ones and they send fine to multiple people, but with the DAG health one it seems to only send to the first person in the list. Is there need to do something slightly differenet with this script?

    Cheers

    Reply
    • Paul Cunningham says

      April 24, 2013 at 11:52 am

      Should work in the format:

      To = “firstemail@domain.com”,”secondemail@domain.com”

      Alternatively, try sending it to a distribution list.

      Reply
      • John Rambosality says

        August 9, 2016 at 2:09 pm

        Hi paul,

        i have tried this format:
        To = “firstemail@domain.com”,”secondemail@domain.com” in xml file,

        but still not work if we send to multiple mailbox. pls help 🙂

        Reply
  84. Mahmoud says

    April 14, 2013 at 6:09 pm

    Thanks Paul for your helpful Script,

    Regarding to the Preference Tap refer to what ?

    Reply
    • Paul Cunningham says

      April 14, 2013 at 7:37 pm

      Preference is the Activation Preference for the database copy.

      Reply
      • Mahmoud says

        June 4, 2013 at 8:00 pm

        Thanks Paul for yor reply,

        I get the following results;

        Database Mounted on Preference
        DB1 HO-MCH-01 1
        DB2 HO-MCH-02 3
        DB3 HO-MCH-03 3

        the fisrt one DB1 prefernce colored with green and the others DB2 & DB3 colored with yellow, could you please explain what this colores mean?

        Reply
        • Paul Cunningham says

          June 4, 2013 at 9:55 pm

          Green = OK
          Yellow = Warning
          Red = Error
          Blue = Information

          Reply
        • Mahmoud says

          June 4, 2013 at 10:12 pm

          thanks for your quick reply , but DB1 that have the green result it’s preference number =1 is this mean that DB1 have one activation Preference for the DB1 copy?

          Reply
        • Paul Cunningham says

          June 4, 2013 at 10:14 pm

          If the activate database copy is the one with the preference of 1 then the result is Green. If the active database copy is one with a higher preference then the result is Yellow to draw your attention to a possible issue.

          Reply
        • Mahmoud says

          June 4, 2013 at 10:34 pm

          Thanks a lot for your explain, i appreciate your Effort Paul you are my teacher 🙂

          Reply
        • Mahmoud says

          June 4, 2013 at 10:36 pm

          Sorry Paul, so what’s the possible issue or how can i check about this issue in the yellow color

          Reply
        • Paul Cunningham says

          June 4, 2013 at 10:38 pm

          It depends which test result has come up as a warning/yellow.

          If its just the preference, then that is just a matter of doing a database switchover to the 1st preference.

          Reply
        • Mahmoud says

          June 4, 2013 at 10:42 pm

          Thank you very much, yes the warning in the preference, so i need to switchover to the best copy of DB.

          Reply
  85. TonyH says

    April 5, 2013 at 5:31 pm

    Thanks Paul. It’s come just at the right time for us as we’ve just finished test our new DAG implementation and will be started the DB copies next week. I’ve run it on the test DBs we have in place and all is good so far!

    Reply
  86. Sorin says

    April 3, 2013 at 3:46 am

    OK, thanks a lot. drop me an email if you need help with testing.

    Reply
  87. Sorin says

    April 1, 2013 at 6:14 pm

    Hi Paul,

    Did someone reported that Activation Preference information is not shown in the report. This is happening in my case. Otherwise the script return valuable info.

    Here is part of output when using “-verbose”:
    VERBOSE: Retrieving Database Availability Groups
    VERBOSE: 2 DAGs found
    VERBOSE: —- Processing DAG xxxx
    VERBOSE: x DAG members found
    VERBOSE: xx DAG databases found
    VERBOSE: —- Processing database xxxxxxxxxxxxxx
    VERBOSE: xxxxxxxxxxxxxx has 3 copies
    VERBOSE: Database Copy: xxxxxxxxxxxxxxxxxxxxxxxxxx
    VERBOSE: Server: xxxxxxxxxxxxxx
    VERBOSE: Activation Preference:
    VERBOSE: Status: Healthy
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 1
    VERBOSE: Content Index: Healthy
    VERBOSE: Database Copy: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    VERBOSE: Server: xxxxxxxxxxxxxx
    VERBOSE: Activation Preference:
    VERBOSE: Status: Healthy
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 1
    VERBOSE: Content Index: Healthy
    VERBOSE: Database Copy: xxxxxxxxxxxxxxxxxxxxxxxxxxxx
    VERBOSE: Server: xxxxxxxxxxxxxx
    VERBOSE: Activation Preference:
    VERBOSE: Status: Mounted
    VERBOSE: Copy Queue: 0
    VERBOSE: Replay Queue: 0

    Thanks a lot.
    Sorin

    Reply
    • Paul Cunningham says

      April 1, 2013 at 8:56 pm

      Interesting. Maybe a permissions issue? Using the same credentials can you run this command and tell me whether you see the list of servers and their preferences in the output?

      Get-MailboxDatabase | select name,activationpreference

      Reply
      • Sorin says

        April 2, 2013 at 4:57 pm

        permissions are fine. Running Get-MailboxDatabase | select name,activationpreference returns correct information:
        Name ActivationPreference
        —- ——————–
        DB1 {[xxxxxxxxxxxx, 1], [xxxxxxxxxxxx, 2], [xxxxxxxxxxxx, 3]}
        DB2 {[xxxxxxxxxxxx, 1], [xxxxxxxxxxxx, 2], [xxxxxxxxxxxx, 3]}
        DB3 {[xxxxxxxxxxxx, 1], [xxxxxxxxxxxx, 2], [xxxxxxxxxxxx, 3]}

        Reply
        • Paul Cunningham says

          April 2, 2013 at 8:58 pm

          Interesting. I will do my best to reproduce that and fix it.

          Reply
  88. Manoj Vijaykumar says

    March 28, 2013 at 7:16 am

    Awesome script Paul. Really love the report. These colored reports definitely help with the management too. Keep up the great work.

    Reply
  89. Alex Logan says

    March 28, 2013 at 2:03 am

    Hi Paul, fantastic script. I just noticed however that after some recent server patching, that I’m getting some false-positves in the HTML output. “Healthy Queues” are all red, but with a value of zero, even though my queues are fine. “Truncation Lagged” and “Content Index” columns are all blank. Any ideas? I’m running 2010 SP2 RU3.

    Thanks again!

    -Alex

    Reply
    • Paul Cunningham says

      March 28, 2013 at 8:15 pm

      Run the script in a PowerShell window with the -verbose switch and see whether anything stands out.

      Reply
      • Alex Logan says

        April 9, 2013 at 8:29 am

        Hi Paul…clean output with the verbose switch so not sure why “Healthy Queues” is listed as “0” and is highlighted red. It was working fine prior to server patches…weird. Any other ideas?

        Thanks!

        Reply
        • Paul Cunningham says

          April 9, 2013 at 10:50 am

          Was it Windows patches or Exchange updates?

          Reply
      • Alex Logan says

        April 9, 2013 at 11:07 am

        Hi Paul, FYI it was windows patches…

        Reply
        • Paul Cunningham says

          April 12, 2013 at 4:24 pm

          Can you ID the list of patches you installed on the date it stopped working, and either send them to me or paste them here? I let my lab servers automatically install updates and I’ve not run into this issue myself.

          Reply
        • Julian says

          April 24, 2013 at 11:41 am

          I am having the same issue on new servers running Exchange 2013 CU1 – Windows 2012.

          Reply
        • Paul Cunningham says

          April 24, 2013 at 11:53 am

          Julian, I have not tested this script at all on Exchange 2013 so you may be seeing some other issue.

          Reply
        • Julian says

          April 24, 2013 at 2:06 pm

          Well it’s definitely the same symptoms. Thanks for the script , I will try to troubleshoot when I find some time.

          Reply
        • Paul Cunningham says

          April 24, 2013 at 3:17 pm

          I get the same issue on WS2012.

          @Alex – I’m thinking this may actually be a PowerShell v3 issue of some kind. Did your servers get updated with the Windows Management Framework 3.0 when the problem started?

          Reply
        • Paul Cunningham says

          April 24, 2013 at 3:56 pm

          @alex and @julian – I think I have found the problem. Will work on a fix and upload a new version as soon as I can.

          Reply
  90. Obi says

    March 20, 2013 at 9:25 am

    Great script, worked like a charm. I got the same error that other reported after the initial run, but none afterwards. Great way to keep track of those pesky “failed” indexes

    Reply
  91. Sankar N says

    March 13, 2013 at 3:03 pm

    Thanks you very much for sharing this Awesome script!!…

    can you add few other command to this script like
    1) Get-Counter “MSExchange RpcclientaccessUser count”
    2) Get-Counter “MSExchange owaCurrent Unique Users”
    from this command we can monitor that no.of user connection has shared equally among CAS servers.

    Reply
  92. Dustin says

    March 12, 2013 at 4:58 am

    Awesome script!! Thank you very much!!

    Reply
  93. Shane Bryan says

    March 4, 2013 at 8:30 am

    Thanks for the great script Paul. I’ve got it running twice a day, sending an email to our shared IT Team mailbox.

    Top work 🙂

    Reply
  94. Javier A says

    March 2, 2013 at 6:41 am

    Thanks, It works great on my environment
    There´s something Im not sure what it means..

    In the Member Health table from one of my DAGs (got 4) shows “N/A” in the following columns

    DB Copy Suspended
    DB Initializing
    DB Disconnected
    DB Log Copy Keeping Up
    DB Log Replay Keeping Up

    All the other columns in the same table shows “Passed”

    Any idea?

    Reply
    • Paul Cunningham says

      March 4, 2013 at 8:19 am

      That usually indicates the server hosts no passive database copies. It isn’t a problem unless you’re concerned about having a balanced distribution of active/passive copies in your DAG.

      Reply
  95. Keith K. says

    March 2, 2013 at 3:43 am

    This script is awesome Paul!
    How often do you recommend running this script. Is it safe to run it maybe every hour or once a twice a day? Just want to make sure that it’s not putting any kind of load on my servers. 🙂
    Thx.

    Reply
    • Paul Cunningham says

      March 4, 2013 at 8:15 am

      I consider it safe to run without putting load on the servers. I run it once in the morning so the report is in my inbox when I start work.

      Reply
  96. David says

    February 28, 2013 at 5:12 am

    Great script, Paul. I added a check for Incremental and Full backups to the “Detailed” switch in your script, but I’m having problems comparing the date to a variable. Any thoughts on what I can do? I can send you the whole script if you want to see how it’s pulled in.

    $incrPass = ((Get-Date).AddDays(-1)).ToString(“yyyy-MM-dd HH:mm:ss”)
    $incrWarn = ((Get-Date).AddDays(-4)).ToString(“yyyy-MM-dd HH:mm:ss”)

    #Warn if Incremental backups have not run recently
    If ($(line.”Last Incremental Backup”).ToString -lt $incrPass)
    {
    $htmltablerow = $htmltablerow + “$($line.”Last Incremental Backup”)”
    }
    Elseif ($(line.”Last Incremental Backup”).ToString -lt $incrWarn)
    {
    $htmltablerow = $htmltablerow + “$($line.”Last Incremental Backup”)”
    }

    Reply
    • Paul Cunningham says

      February 28, 2013 at 8:46 am

      I’ve published an entire script for checking backups. You might prefer to use that or use some of the code from it to customize your own.

      https://www.practical365.com/set-automated-exchange-2010-database-backup-alert-email

      Reply
      • David says

        March 1, 2013 at 2:35 am

        Sounds good, I’ll check it out. Thanks.

        Reply
      • David says

        March 1, 2013 at 2:58 am

        Just to follow up, I looked at your code and then back at mine when I realized I was missing a “$” in my “($(line.”Last Incremental backup”)” section. I looks like it all works now. I can send you the change if you want to give it a shot. If not, no worries.

        Thanks again, and keep the scripts coming! 🙂

        Reply
  97. Arras says

    February 23, 2013 at 5:46 am

    Works Perfect!
    Q: On the Health Summary table, Column Preference, it shows 1 Green and the rest of the DB’s 2 Yellow. What does the Yellow represents?
    Thanks.

    Database Mounted on Preference
    DB01 SecondServer 1
    DB02 FirstServer 2
    DB03 SecondServer 2
    DB04 FirstServer 2
    DB05 SecondServer 2
    DB06 FirstServer 2
    DB07 SecondServer 2
    DB08 FirstServer 2
    DBTest SecondServer 2

    Reply
    • Paul Cunningham says

      February 23, 2013 at 5:48 am

      Yellow indicates that the database is mounted on a server that is not Activation Preference 1.

      Reply
  98. Carsten says

    February 21, 2013 at 8:05 am

    Great script!

    Is there a way to modify it so that it only sends an email if the script turns up a red flag? That would be really useful.

    Reply
    • Paul Cunningham says

      February 23, 2013 at 5:39 am

      Well, it is PowerShell so of course it can be modified to do anything you like 🙂

      But consider that the script also checks for a lot of “warning” conditions that aren’t necessarily an error or serious fault but may be something that the administrator wants to be aware of.

      Reply
  99. Kirill says

    February 20, 2013 at 11:32 pm

    Thank you, script is very useful, I testing in my enviroment, and have some questions.

    When i get report on mail, some word looks like ????? for example curent date and PASSED for member health, in yellow bars i see ?????

    I am using russian 2008 r2 and Exchange 2010, where i must fix code page ? Please help.

    Anyway thanks, script realy helps monitor DAG Group

    Reply
    • Paul Cunningham says

      February 23, 2013 at 5:37 am

      Try adding the encoding parameter that another person mentions here:

      https://www.practical365.com/get-daghealth-ps1-database-availability-group-health-check-script#comment-13966

      Reply
  100. Stephan Versluis says

    February 20, 2013 at 10:39 pm

    Thanks Paul!
    Great script once again 🙂

    Cheers!

    Reply
  101. Diego says

    February 20, 2013 at 1:42 am

    Great script. I missed only the sort function in line 162 for a optimized view (for the case that the server have different names).

    $tmpservers = @(Get-ExchangeServer) |sort

    Reply
  102. Robert Coggins says

    February 16, 2013 at 5:53 am

    I am having a hard time getting this to run as a scheduled job where “Run whether user is logged on or not” is selected. It runs just fine with the “Run only when user is logged on”.

    When redirecting output I get:
    VERBOSE: Connecting to myserv1.domain
    VERBOSE: Connecting to myserv1.domain
    VERBOSE: Connecting to myserv1.domain
    VERBOSE: Connecting to myserv1.domain
    Failed to connect to an Exchange server in the current site.

    Any ideas?

    Reply
    • Paul Cunningham says

      February 18, 2013 at 5:18 pm

      Are you also ticking the “run with highest privileges” box?

      Reply
      • Robert Coggins says

        February 19, 2013 at 12:23 am

        I am checking it.

        Reply
        • Robert Coggins says

          February 19, 2013 at 12:25 am

          Sorry that is not very clear. Yes, it is checked.

          Reply
        • Paul Cunningham says

          February 19, 2013 at 4:33 pm

          Could it be the credentials you’re using do not have the required rights? I’ll admit I haven’t put any thought yet into a nice RBAC role for this script and I just run it with a full Org Admin in my test lab for now. I’m wondering if you’re accidentally running it as the local admin on the server or something like that?

          Reply
        • Robert Coggins says

          February 20, 2013 at 12:19 am

          First I gave only view only org manager rights but then I gave full Org Man rights. And the script runs as the user when logged in as the user or if I select “Run only when user is logged on”. I will play with it more and will update if I find something.

          Reply
  103. Martin says

    February 15, 2013 at 10:46 pm

    Thx Paul … really nice!

    Reply
  104. John Bruijntjes says

    February 15, 2013 at 7:21 pm

    Thanks for the effort Paul!

    Reply
  105. Oleg A says

    February 15, 2013 at 6:19 pm

    Super! Very usefull and great script. Thank you very much.

    Little bug report:
    1. I’m also get Update-TypeData error ( http://pastebin.com/putBAuAu ) on first run of script as Alex C.
    2. Because of Russian date and time formats on server I get email with question marks instead of month name.
    So I added -Encoding parameter to Send-MailMessage commandlet and month name now in russian like it should. Now my command looks like this:
    Send-MailMessage @smtpsettings -Body $htmlreport -BodyAsHtml -Encoding ([System.Text.Encoding]::UTF8)

    Thanks again.
    Best regards,
    Oleg.

    Reply
    • Paul Cunningham says

      February 19, 2013 at 4:32 pm

      I always seem to forget to set that encoding. Thanks for pointing it out, will fix in next version.

      Reply
    • Kusado says

      March 15, 2013 at 4:05 pm

      I’ve just added one line in the if ($SendEmail) block:
      $encoding = [System.Text.Encoding]::UTF8
      No need to add more paramaters to command line.
      Also added more options to switch operators to support russian translation, they now look like
      Switch ($($line.TCPListener))
      {
      $null { $htmltablerow = $htmltablerow + “$($line.TCPListener)” }
      “Passed” { $htmltablerow = $htmltablerow + “$($line.TCPListener)” }
      “Проверка пройдена” { $htmltablerow = $htmltablerow + “$($line.TCPListener)” }
      default { $htmltablerow = $htmltablerow + “$($line.TCPListener)” }
      }

      Reply
      • Kusado says

        March 15, 2013 at 4:07 pm

        + “-Encoding $encoding” after send-emailmessage

        Reply
  106. Scott Brown says

    February 15, 2013 at 9:50 am

    Hi Paul,

    I am getting the below error when trying to run the script. My be a user error but just wondering if you can help?

    [PS] C:Install.set>.Get-DAGHealth.ps1
    The ‘<' operator is reserved for future use.
    At C:Install.setGet-DAGHealth.ps1:109 char:51
    + $summaryintro = "Database Availability Group < <<<$($dag.Name) Health Summary:”
    + CategoryInfo : ParserError: (<:OperatorToken) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

    Reply
    • Scott Brown says

      February 15, 2013 at 10:00 am

      All good find the error. It was a user error in the email address…

      Reply
  107. Shane Bryan says

    February 15, 2013 at 9:30 am

    Just ran it, worked perfectly first time. Scheduled task is in place to run it a few times per day. Not quite at the point where I can sit on the beach 8 hours a day, but getting close thanks to Paul :-p

    Reply
  108. Ed says

    February 15, 2013 at 7:48 am

    Who needs expensive monitoring software when you got great scripts like this.

    Thanks Paul, great work mate.

    Ed

    Reply
    • Paul Cunningham says

      February 15, 2013 at 9:38 am

      Good monitoring software is worth the price. But yeah, for those who can’t afford it thank goodness PowerShell lets us build scripts like this 🙂

      Reply
  109. Dan says

    February 15, 2013 at 6:55 am

    Thanks awesome script
    very helpful

    Reply
  110. ram says

    February 15, 2013 at 3:06 am

    Hi Paul

    This script is really awesome and am huge fan of you

    Only one Flow which i found is , if the DB is moved or failover from one server to another server

    can it be show like

    DBName on server2 should be on Server1

    what am trying tell is DB is server1 , due to some N/w issue and the DB was moved and sitting on Server 2

    can this report show like DBName on server2 should be on Server1

    or am i missing the information in this report.

    Reply
    • Paul Cunningham says

      February 15, 2013 at 9:37 am

      The script doesn’t attempt to diagnose in detail or recommend a specific action be taken. It is intended to present you enough details of possible issues so that you can make decisions about how to remediate problems.

      So in the case of databases not being on their activation preference 1 server, the script flags that in the summary table, and then in the details table it also tells you which server is AP1 for that DB (but you can easily see that in EMC anyway). So then its up to you whether the DB should be moved or not.

      Reply
  111. Mykul says

    February 15, 2013 at 1:18 am

    Awesome script Paul.

    Thanks!

    Reply
  112. Alex C says

    February 15, 2013 at 1:12 am

    Thank you very much, Paul, for sharing your work! Awesome! 🙂
    For your information, and I guess you already know, when running the script, the following errors are displayed, though the script is executing perfectly.

    Update-TypeData : The following error occurred while loading the extended type data file:
    Microsoft.PowerShell, D:Program FilesMicrosoftExchange ServerV14binexchange.types.ps1xml : File skipped because it was already present from “Microsoft.PowerShell”.

    Update-TypeData : The following error occurred while loading the extended type data file:
    Microsoft.PowerShell, D:Program FilesMicrosoftExchange ServerV14binExchange.partial.Types.ps1xml : File skipped because it was already present from “Microsoft.PowerShell”.

    I was running the script in a normal EMS session.
    Thanks again!
    Cheers,
    Alex

    Reply
    • Paul Cunningham says

      February 15, 2013 at 9:35 am

      Thanks Alex, I’ll work on that bug.

      Reply
  113. wasim says

    February 15, 2013 at 12:08 am

    Thanks paul

    great script….

    Reply
  114. Patrick Dunnigan says

    February 14, 2013 at 11:36 pm

    I’m trying to run the DAG Heath Report on the same server I have your previous Health Check report running. When I run the Dag Report, Powershell gives me the following errors, any ideas?

    Update-TypeData : The following error occurred while loading the extended type data file:
    Microsoft.PowerShell, C:Program FilesMicrosoftExchange ServerV14binexchange.types.ps1xml : File skipped because i
    t was already present from “Microsoft.PowerShell”.
    At C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1:94 char:17
    + Update-TypeData <<<< -PrependPath $typeFilePath
    + CategoryInfo : InvalidOperation: (:) [Update-TypeData], RuntimeException
    + FullyQualifiedErrorId : TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand

    Update-TypeData : The following error occurred while loading the extended type data file:
    Microsoft.PowerShell, C:Program FilesMicrosoftExchange ServerV14binExchange.partial.Types.ps1xml : File skipped b
    ecause it was already present from "Microsoft.PowerShell".
    Microsoft.PowerShell, C:Program FilesMicrosoftExchange ServerV14binexchange.types.ps1xml : File skipped because i
    t was already present from "Microsoft.PowerShell".
    At C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1:104 char:16
    + Update-TypeData <<<< -PrependPath $partialTypeFile
    + CategoryInfo : InvalidOperation: (:) [Update-TypeData], RuntimeException
    + FullyQualifiedErrorId : TypesXmlUpdateException,Microsoft.PowerShell.Commands.UpdateTypeDataCommand

    Reply
    • Paul Cunningham says

      February 15, 2013 at 9:35 am

      Thanks. I believe that is a harmless bug during the script initialization that can be ignored, but let me know if you’re also not getting any results at all from the script when it finishes. In the mean time I’ll try to squash that bug.

      Reply
      • Patrick says

        February 18, 2013 at 8:23 pm

        It seems to be working fine, great script.

        Reply
  115. Shane Bryan says

    February 14, 2013 at 11:35 pm

    Whoah, can’t wait to give this a run tomorrow 🙂

    Reply
  116. Hein says

    February 14, 2013 at 11:25 pm

    Up and running. So far works just fine. Nice work Paul! No flaws detected yet.

    Reply
  117. Sam says

    February 14, 2013 at 11:08 pm

    GENIUS!!

    Thanks Paul, Another great script

    Reply

Leave a Reply Cancel reply

You have to agree to the comment policy.

Recent Articles

  • Changes in Microsoft 365 Apps Channels and Why You Should Care
  • A New Tool to Manage Exchange-related Attributes Without Exchange Server
  • Microsoft Launches Group Ownership Governance Policy
  • Making the Case for Identity Governance in Azure Active Directory
  • Prepare an Office 365 migration plan assessment using PowerShell

Copyright © 2022 Quadrotech Solutions AG · Disclosure · Privacy Policy
Alpenstrasse 15, 6304 Zug, Switzerland