Comparing receive connectors
Continuing with our previous scenario, maintaining receive connectors across multiple servers can be challenging. Ensuring that two or more connectors have the exact same list of IP addresses using the EAC is not easy, especially if the list of IPs is extensive.
In this recipe, we will look at a simple script to compare the list of IP addresses configured in two receive connectors and print any differences.
How to do it...
To compare the list of IP addresses configured in two receive connectors, we need to compare their RemoteIPRanges
properties. The following script does exactly that:
$recCon1 = "EX1\Relay"$recCon2 = "EX2\Relay"$recCon1IPs = (Get-ReceiveConnector $recCon1).RemoteIPRanges$recCon2IPs = (Get-ReceiveConnector $recCon2).RemoteIPRanges$comparison = Compare-Object -ReferenceObject $recCon1IPs -DifferenceObject $recCon2IPs$comparison | Select InputObject, @{n="Connector"; e={If ($_.SideIndicator -eq "<=") {$recCon1} ElseIf ($_.SideIndicator -eq "=>...