Test-OutboundConnector.ps1
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
<#
.SYNOPSIS This function tests all outbound connectors for centralized mail transport. .DESCRIPTION This function tests all outbound connectors for centralized mail transport. .EXAMPLE Test-OutboundConnector -overrideCentralizedMailTransportEnabled:$TRUE #> Function Test-OutboundConnector { [cmdletbinding()] Param ( [Parameter(Mandatory = $true)] $overrideCentralizedMailTransportEnabled ) #Output all parameters bound or unbound and their associated values. write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore) #Define variables that will be utilzed in the function. [array]$exchangeOnlineOutboundConnectors=@() #Initiate the test. Out-LogFile -string "********************************************************************************" Out-LogFile -string "BEGIN Test-OutboundConnectors" Out-LogFile -string "********************************************************************************" $exchangeOnlineOutboundConnectors = get-o365OutboundConnector if ($overrideCentralizedMailTransportEnabled -eq $FALSE) { foreach ($outboundConnector in $exchangeOnlineOutboundConnectors) { if ($outboundConnector.RouteAllMessagesViaOnPremises -eq $TRUE) { out-logfile -string "***WARNING***" out-logfile -string "Centralized transport is enabled." out-logfile -string "When centralized mail transport is enabled - if the migrated group contains any on premises mailboxes the public MX is utilized for routing." out-logfile -string "If not properly tested this could lead to NDRs or messages appearing as external to on premises resources." out-logfile -string "Migrating this DL can only be accomplished by acknolwedging centralized mail transport is enabled using the -overrideCentalizedMailTransportEnabled:$TRUE" out-logfile -string $outboundConnector.name out-logfile -string $outboundConnector.RouteAllMessagesViaOnPremises out-logfile -string "***WARNING***" -isError:$true } else { out-logfile -string "Connector not enabled for centralized mail transport." out-logfile -string $outboundConnector.Name out-logfile -string $outboundConnector.RouteAllMessagesViaOnPremises } } } else { foreach ($outboundConnector in $exchangeOnlineOutboundConnectors) { if ($outboundConnector.RouteAllMessagesViaOnPremises -eq $TRUE) { out-logfile -string "***WARNING***" out-logfile -string "Centralized transport is enabled." out-logfile -string "When centralized mail transport is enabled - if the migrated group contains any on premises mailboxes the public MX is utilized for routing if the message originated from on premises." out-logfile -string "If not properly tested this could lead to NDRs or messages appearing as external to on premises resources." out-logfile -string "The administrator has acknowledged the warning by overriding centralized mail transport enabled." out-logfile -string $outboundConnector.name out-logfile -string $outboundConnector.RouteAllMessagesViaOnPremises out-logfile -string "***WARNING***" } else { out-logfile -string "Connector not enabled for centralized mail transport." out-logfile -string $outboundConnector.Name out-logfile -string $outboundConnector.RouteAllMessagesViaOnPremises } } } Out-LogFile -string "END Test-OutboundConnector" Out-LogFile -string "********************************************************************************" } |