I have a transport rule in Exchange 2013 that I created in the EAC (mail flow>rules). it is set so *Apply this rule if.. the sender's domain is.. and then I entered a few domains.
I want to use a powershell script to enter multiple domains into the senderdomainis parameter using the set-transportrule. I would like to do this from a csv input file. The file has header row of domains and then the domains are listed under it. This is also used successfully in a script that does content and sender id filter additions.
I tried the following:
$allowed = import-csv c:\temp\allowed.csv
$Rule=get-transportrule "safe domain List"
$Senderdomains =$rule.senderdomainis
foreach($row in $allowed)
{
$Senderdomains +=$row.domain
}
#Set-Transportrule "Safe Domain List" -senderdomainis $Senderdomains
It just adds a long line of all the domains mashed together without separation.
Any ideas would be helpful.
Thanks.