Quantcast
Channel: Exchange Server 2013 - Mail Flow and Secure Messaging forum
Viewing all articles
Browse latest Browse all 3660

Powershell script to add multiple domains to a transport rule

$
0
0

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.


Viewing all articles
Browse latest Browse all 3660

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>