Forum Discussion
StefanoC66
Oct 22, 2024Iron Contributor
creation of exchange receive connector from csv
I'm trying to create a script that should create an exchange receive connector from a CSV file that contains the list of the connectors to create as well as some properties. The problem is not the c...
LainRobertson
Oct 23, 2024Silver Contributor
Hi, Stefano.
The sample data and the values shown in the error aren't the same, so I'm going to work from the data that features in the error (notably, the source data doesn't contain a comma between the ranges while in the error it does).
The issue, then, is that the value of "192.168.101.0/23,192.168.102.0/23" is being passed in as a single string on the call to New-ReceiveConnector when what is required is an array. As a single string, the value is invalid, hence the error.
You haven't provided your command/script so I can only offer a general example for splitting the string.
# Assumption: That we're inside of a foreach loop where the current CSV row is contained in $entry.
$ipRanges = $entry.remoteIpRange.Split(",");
# Partial command only showing the RemoteIPRanges parameter.
New-ReceiveConnector -RemoteIPRanges $ipRanges;
Cheers,
Lain