Home » Blog » Test-ExchangeServerHealth.ps1 v1.2 Released

Test-ExchangeServerHealth.ps1 v1.2 Released

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.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Blog

23 comments

  1. Luca says:

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

  2. Marc says:

    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 ;-(

    • 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.

      • Marc says:

        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. 🙂

  3. Fahad says:

    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

  4. Fahad says:

    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

    • 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.

  5. Raj says:

    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.

    • Raj says:

      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

  6. Stephane says:

    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.

      • Stephane says:

        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.

          • Stephane Gagne says:

            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.

  7. Aleem Ijaz Janjua says:

    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.

Leave a Reply

Your email address will not be published. Required fields are marked *