All scripts
Microsoft 365 134

Get-MailFlowConnectorReport

Lists every inbound and outbound mail flow connector with its configuration, so a legacy connector from an old migration or a third party mail gateway does not go unnoticed.

Get-MailFlowConnectorReport.ps1
<#
.SYNOPSIS
    Reports all inbound and outbound mail flow connectors.

.DESCRIPTION
    Lists every configured inbound and outbound connector with its
    enabled state, connector type and source or destination, since old
    connectors from a migration or a third party gateway tend to be
    forgotten once the project that created them wraps up.

.EXAMPLE
    .\Get-MailFlowConnectorReport.ps1

.NOTES
    Requires ExchangeOnlineManagement and an active Connect-ExchangeOnline session.

.AUTHOR
    Shehryar Hassan
#>

$inbound = Get-InboundConnector | Select-Object Name, Enabled, ConnectorType, SenderDomains, @{N="Direction";E={"Inbound"}}
$outbound = Get-OutboundConnector | Select-Object Name, Enabled, ConnectorType, RecipientDomains, @{N="Direction";E={"Outbound"}}

Write-Host "Inbound connectors:" -ForegroundColor Cyan
$inbound | Format-Table -AutoSize

Write-Host "Outbound connectors:" -ForegroundColor Cyan
$outbound | Format-Table -AutoSize

Read it before you run it, and test in a safe tenant first.