Hi @Surya kumar ,
Prepare the CSV file for the IPs you want to add like below:
Then you can use the following scripts to import the IPs without overwriting the existing ones. Be sure to replace the first two lines with the file path and connector identity in your environment:
$Csv = "C:\temp\IPs.csv"
$RC = "EX19\TEST"
$IPs = Import-Csv $Csv
$RCon = Get-ReceiveConnector $RC
$RemoteIPRanges = $RCon.RemoteIPRanges
foreach ($IP in $IPs) {
$IPEx = $IP.Expression
if ($RemoteIPRanges -contains $IPEx) {
Write-Host "IP address $($IPEx) already exist in receive connector $($RC)" -ForegroundColor Red
}
else {
$RemoteIPRanges += $IPEx
Set-ReceiveConnector $RC -RemoteIPRanges $RemoteIPRanges
Write-Host "IP address $($IPEx) added to receive connector $($RC)" -ForegroundColor Green
}
}
I tried testing in my lab environment and can verify that it can work properly:
Here's a blog with more detailed instructions and script samples for your reference: Import remote IP addresses to Exchange receive connector.
(Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.