Adding IP address to receive connectors
When using custom receive connectors to allow applications to relay emails, there will eventually come a time when we need to add an IP address to such a connector. In small environments, this is typically not an issue, but if the IP address needs to be added to multiple connectors, then it can take a long time to do this using the EAC. Especially if this needs to happen frequently. In such cases, PowerShell is the best option.
In this recipe, we will see how to add IP addresses to one or more receive connectors.
How to do it...
To add one or more IP address to a single receive connector, we can use the following code:
$recCon = Get-ReceiveConnector "EX1\Relay"$recCon.RemoteIPRanges += "172.28.125.239", "172.28.125.242", "172.28.125.249"Set-ReceiveConnector $recCon -RemoteIPRanges $recCon.RemoteIPRanges
How it works...
We start off by getting the entire configuration of the receive connector we want to update and saving it into the $recCon
variable. Then...