I have just uploaded version 1.2 of the Test-ExchangeServerHealth.ps1 script.

This version includes a number of important bug fixes, as well as adding the DAG health check (from Get-DAGHealth.ps1).

You can download the new version here.

Please continue to report bugs and make feature requests in the comments on that post.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Shaik

    We have Exchange 2016 wherein in two servers Hub Transport Role Service & Mailbox Role Service says “Fail” in the report but services running fine

    1. Avatar photo
      Paul Cunningham

      Use the Test-ServiceHealth cmdlet to see which services are not running.

  2. Veljko Grubacic

    This works in my environment (WS2012 with EX2013 SP1)

    Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    Argument : -command C:\Test-ExchangeServerHealth.ps1 -reportmode -sendemail

  3. Aleem Ijaz Janjua

    Thanks for the script Paul.

    I’m facing issue in scheduling this script from the task scheduler. I get the wrong report in which the “Up time hrs comes with “Unable to retrieve up time ” and Client Access Server Roles Services “fail”. But when i run this script through windows power shell the report comes perfectly, without any issues.

    I used the same arguments which you have mentioned in your comment earlier.

    can you please tell me how can i get the correct report through task scheduler.

  4. Stephane

    Hi Paul,

    Thanks for the script. Very useful and great that they integrate both DAG I have (2010/2013)

    I have deployed new 2013 exchange servers with cas/mbx roles within my exchange 2010 domain. I’m still in a co-existence mode which should be all in 2013 soon.

    While running your script, everything is green šŸ™‚ except for the mail flow test on 2013 servers were both fails.

    I was able to test and send emails back and forth from all exchange servers and don’t really understand why I’m getting a mail flow test as failed. Do you have any clues to help me to troubleshoot?

    Do you have any plans to integrate % disk space free where databases are?

    Thank you very much for you help and script.

    1. Avatar photo
      Paul Cunningham

      If your own mail flow tests are working then it may just be a false alarm from the script.

      1. Stephane

        Lol…

        Noticed that they are blocked by GFI Mailessential… oups !
        This is the header:
        ——–
        From: Microsoft Outlook SMTP From:
        SMTP To: SystemMailbox{0e6665de-a64e-4e60-a46c-8a165a858b11}@domain.com
        To: SystemMailbox{0e6665de-a64e-4e60-a46c-8a165a858b11}@domain.com;
        ——–
        Any way I can fill up the “SMTP From ” so I can whitelist?

        Thanks.

        1. Avatar photo
          Paul Cunningham

          GFI shouldn’t be blocking system messages like that. I would consider that to be a bug with GFI.

          1. Stephane Gagne

            By digging further, running the command get-mailbox | ft name,guid didn’t return any mailboxes with this associated guid. Is there a way to confirm that this system mailbox really exist? Should it work?

            Thanks.

  5. Raj

    Hello Paul,

    Great script !!!
    However I have few errors.

    When I run Script with -Server “ServerName” it works excellent however when I use Ignorelist it doesn’t complete.

    .Test-ExchangeServerHealth.ps1 -SendEmail -ReportMode doesnt go to Finish line

    .Test-ExchangeServerHealth.ps1 -Server -ReportMode -SendEmail completes as expected

    Any help is highly appreciated

    Regards,
    Raj.

    1. Raj

      After waiting for long time… i.e. may be after 30 minutes I get below error and still script doesn’t complete

      WARNING: Windows Failover Clustering encountered a transient error. Trying the operation again may be successful. Error:
      ‘IsNodeClustered’.
      Add-Member : Cannot bind argument to parameter ‘Name’ because it is null.
      At :ExchangeHealthCheckTest-ExchangeServerHealth.ps1:1553 char:53
      + $memberObj | Add-Member NoteProperty -Name <<<< $($healthitem.Check) -Value $healthitemresult -Force
      + CategoryInfo : InvalidData: (:) [Add-Member], ParameterBindingValidationException
      + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddMemberComm
      and

    2. Avatar photo
      Paul Cunningham

      If you’re using -Server then you need to specify the server name you want to check.

      .Test-ExchangeServerHealth.ps1 -Server SERVERNAME -ReportMode -SendEmail

  6. Fahad

    hey Paul

    I checked TechNet & github & only then I posted this comment. I apologize if i’m missing something here or if i’m over-looking something silly.

    This is a portion of the script which I downloaded from TechNet

    V1.10, 19/08/2014 – Fixed bug with E14 replication health not testing correct server.
    V1.11, 11/02/2015 – Added queue length to Transport queue result in report.
    V1.12, 5/03/2015 – Fixed bug with color-coding in report for Transport Queue length.
    V1.13, 7/03/2015 – Fixed bug with incorrect function name used sometimes when trying to call Write-LogFile
    #>

    #requires -version 2

    https://gallery.technet.microsoft.com/office/Generate-Health-Report-for-19f5fe5f

    Also, do u have any clue on the below error:

    Iā€™m getting an error like below in version 1.11:
    Remove-PSSession cannot validate argument on parameter ā€œIDā€. The argument is Null. Provide a valid value for the argument, and then try running the command again.
    At C:Program Filesā€¦.test-exchangeserverhealth.ps1:422 Char:19

    Do I need to provide some variable value anywhere?
    My Mailflow test fails on windows server 2012 r2 but If I run it manually it works.

    Thanks
    Fahad

    1. Avatar photo
      Paul Cunningham

      There’s been a few reports of bugs with the mail flow test. To be honest it is somewhat of a hack to get it working in the first place with Exchange 2013. I haven’t been able to reproduce the bug in my own test environments which run CU7 so I’m no closer to finding a fix. I’m working on a replacement health check script for Exchange 2013 anyway that leverages more Managed Availability features rather than Test-* cmdlets, so this bug might never get fixed.

  7. Fahad

    Hi Paul,

    In the above blog you mentioned you have updated the latest script version 1.2 but when we download the script it is 1.11 .
    Please give the link for latest version.

    I’m getting an error like below in version 1.11:
    Remove-PSSession cannot validate argument on parameter “ID”. The argument is Null. Provide a valid value for the argument, and then try running the command again.
    At C:Program Files….test-exchangeserverhealth.ps1:422 Char:19

    1. Avatar photo
      Paul Cunningham

      You can always find the latest version by going to the TechNet or Github page for the script.

  8. W Bach

    Hi Paul,

    currently i cannot register for the members area to download the script. When i browse to http://inside.exchangeserverpro.com/register i cannot find a register form.
    Am i doing something wrong? Maybe you can look at it?
    Kind regards

      1. v-9basa

        Hi Paul,

        Is there a script which will give us exchange resources report like disk size, quota usage per mailbox in percentage, transport data drive size, white space, no. of users per databse and these mailboxes who haven’t logged since 30 days or more, disabled mailboxes, most active mailboxes, and those mailboxes who are near to warning quota, and any other important exchange resources you can think of..thanks. I am using your scripts gat-daghealth and get-mailboxstatistcs scripts..thanks a lot for those scripts…..any inputs for my request

  9. Phil Ready

    Hi Paul
    Great script!
    I have been using with Exchange 2010. Do you have a updated version for Exchange 2013?

  10. Marc

    I am getting really frustrated the script via Task Scheduler.

    Environment:
    Windows 2008 R2
    Exchange 2010

    Problem >>
    I have two environments:
    Lab Environment: It works via Task Scheduler and when I run manually.
    Production Environment: Only if I run the scripts manually. Not via Task Scheduler.

    The user I am using on my production environment is a member of Domain Admins + Organization Management.
    If I log in the production environment I can run my scripts manually successfully.

    How my Task is configured:
    Run whether user is logged or not – checked
    Run with high privileges – checked

    Program/script: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
    Argument: -Version 2.0 -NonInteractive -WindowsStyle Hidden -executionpolicy unrestricted -command “. ‘c:Program FilesMicrosoftExchange Serverv14binRemoteExchange.ps1’; Connect-ExchangeServer -auto; c:scriptsTest-ExchangeServerHealth.ps1 -Log -SendEmail”

    No matter what I do, the task seems to complete(according the history of the task – no erros whatsoever) but it does not send the report.

    Initially I thought was my SMTP server, but if I run the script manually works….like:
    .Test-ExchangeServerHealth.ps1 -Log -SendEmail”

    I already ran:
    Set-ExecutionPolicy Unrestricted
    Set-ExecutionPolicy RemoteSigned
    No difference!

    If I run manually it works. The same happens with another script (Get-ExchangeEnvironmentReport). If I run manually it works. If I try to run via Task Scheduler, nothing happens.
    I reckon it is a permission issue. But to be honest I am running out of ideas.

    Any ideas?
    Please help ;-(

    1. Avatar photo
      Paul Cunningham

      My task scheduler argument is just:

      -command “C:ScriptsExchangeServerHealthTest-ExchangeServerHealth.ps1 -Log -SendEmail”

      You don’t need to call remoteexchange.ps1 and connect-exchangeserver. The script handles that for you.

      Other than that, when in doubt just open a cmd.exe and paste in the full one-liner command you’re trying to run via Task Scheduler (eg powershell.exe -command “blah”) and see if that gives you any more clues.

      1. Marc

        Thanks Paul
        I managed to have it working using the following argument:

        -command “. ā€˜C:Program FilesMicrosoftExchange ServerV14binRemoteExchange.ps1′; Connect-ExchangeServer -auto; c:ScriptsTest-ExchangeServerHealth.ps1 -Log -SendEmail”

        I will leave like this now. šŸ™‚

  11. Luca

    Thanks Paul!!
    the script is really useful and saves me a lot of time during daily activity.
    Really a great job!!

Leave a Reply