From 964389078d84db6b036c277a3c01141c5bc0a99f Mon Sep 17 00:00:00 2001 From: aepli Date: Fri, 21 Apr 2017 12:24:08 +0200 Subject: [PATCH] Fix Mail flow test returns MapiExceptionSendAsDenied with -Server or -ServerList parameters. --- Test-ExchangeServerHealth.ps1 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Test-ExchangeServerHealth.ps1 b/Test-ExchangeServerHealth.ps1 index 5e0196a..94c5a49 100644 --- a/Test-ExchangeServerHealth.ps1 +++ b/Test-ExchangeServerHealth.ps1 @@ -651,9 +651,20 @@ else } ### Check if any Exchange 2013 servers exist -if ($GetExchangeServerResults | Where-Object {$_.AdminDisplayVersion -like "Version 15.*"}) +[bool]$HasE15 = $false +if ($GetExchangeServerResults -ne $null) { - [bool]$HasE15 = $true + if ($GetExchangeServerResults | Where-Object {$_.AdminDisplayVersion -like "Version 15.*"}) + { + [bool]$HasE15 = $true + } +} +else +{ + if ($exchangeservers | Where-Object {$_.AdminDisplayVersion -like "Version 15.*"}) + { + [bool]$HasE15 = $true + } } ### Begin the Exchange Server health checks